mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 12:18:00 +00:00
MagicColor: use Enum for Human chooseColors
This commit is contained in:
@@ -993,7 +993,7 @@ public class DeckRecognizer {
|
||||
|
||||
private static String getMagicColourLabel(MagicColor.Color magicColor) {
|
||||
if (magicColor == null) // Multicolour
|
||||
return String.format("%s {W}{U}{B}{R}{G}", getLocalisedMagicColorName("Multicolour"));
|
||||
return String.format("%s {W}{U}{B}{R}{G}", Localizer.getInstance().getMessage("lblMulticolor"));
|
||||
return String.format("%s %s", magicColor.getLocalizedName(), magicColor.getSymbol());
|
||||
}
|
||||
|
||||
@@ -1039,22 +1039,6 @@ public class DeckRecognizer {
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the magic color by the localised/translated name.
|
||||
* @param localisedName String of localised color name.
|
||||
* @return The string of the magic color.
|
||||
*/
|
||||
public static String getColorNameByLocalisedName(String localisedName) {
|
||||
Localizer localizer = Localizer.getInstance();
|
||||
|
||||
if(localisedName.equals(localizer.getMessage("lblWhite"))) return MagicColor.Constant.WHITE;
|
||||
if(localisedName.equals(localizer.getMessage("lblBlue"))) return MagicColor.Constant.BLUE;
|
||||
if(localisedName.equals(localizer.getMessage("lblBlack"))) return MagicColor.Constant.BLACK;
|
||||
if(localisedName.equals(localizer.getMessage("lblRed"))) return MagicColor.Constant.RED;
|
||||
if(localisedName.equals(localizer.getMessage("lblGreen"))) return MagicColor.Constant.GREEN;
|
||||
|
||||
return "";
|
||||
}
|
||||
public static boolean isDeckName(final String lineAsIs) {
|
||||
if (lineAsIs == null)
|
||||
return false;
|
||||
|
||||
@@ -10,7 +10,6 @@ import forge.card.mana.ManaCost;
|
||||
import forge.card.mana.ManaCostShard;
|
||||
import forge.deck.CardPool;
|
||||
import forge.deck.Deck;
|
||||
import forge.deck.DeckRecognizer;
|
||||
import forge.deck.DeckSection;
|
||||
import forge.game.*;
|
||||
import forge.game.ability.AbilityKey;
|
||||
@@ -1833,9 +1832,9 @@ public class PlayerControllerHuman extends PlayerController implements IGameCont
|
||||
@Override
|
||||
public List<String> chooseColors(final String message, final SpellAbility sa, final int min, final int max,
|
||||
List<String> options) {
|
||||
options = options.stream().map(DeckRecognizer::getLocalisedMagicColorName).collect(Collectors.toList());
|
||||
List<String> choices = getGui().getChoices(message, min, max, options);
|
||||
return choices.stream().map(DeckRecognizer::getColorNameByLocalisedName).collect(Collectors.toList());
|
||||
List<MagicColor.Color> enumOptions = options.stream().map(s -> MagicColor.Color.fromByte(MagicColor.fromName(s))).collect(Collectors.toList());
|
||||
List<MagicColor.Color> enumChoices = getGui().getChoices(message, min, max, enumOptions);
|
||||
return enumChoices.stream().map(MagicColor.Color::getName).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user