Package mage.Constants

Examples of mage.Constants.ColoredManaSymbol


    }

    // Add optimal basic lands to deck.
    while (deck.getCards().size() < DECK_SIZE) {

      ColoredManaSymbol bestColor = null;
      int lowestRatio = Integer.MAX_VALUE;
      for (final ColoredManaSymbol color : ColoredManaSymbol.values()) {

        final Integer count = colorCount.get(color.toString());
        if (count != null && count > 0) {
          final int source = colorSource.get(color.toString());
          final int ratio;
          if (source < MIN_SOURCE) {
            ratio = source - count;
          } else {
            ratio = source * 100 / count;
          }
          if (ratio < lowestRatio) {
            lowestRatio = ratio;
            bestColor = color;
          }
        }
      }
      final Card landCard = getBestBasicLand(bestColor);
      Integer count = colorSource.get(bestColor.toString());
      count++;
      colorSource.put(bestColor.toString(), count);
      deck.getCards().add(landCard);
    }
  }
View Full Code Here


            }
        }

        // Add optimal basic lands to deck.
        while (deck.getCards().size() < deckSize) {
            ColoredManaSymbol bestColor = null;
            //Default to a color in the allowed colors
            if (allowedColors != null && !allowedColors.isEmpty()) {
                bestColor = allowedColors.get(new Random().nextInt(allowedColors.size()));
            }
            int lowestRatio = Integer.MAX_VALUE;
            for (final ColoredManaSymbol color : ColoredManaSymbol.values()) {

                final Integer count = colorCount.get(color.toString());
                if (count != null && count > 0) {
                    final int source = colorSource.get(color.toString());
                    final int ratio;
                    if (source < MIN_SOURCE) {
                        ratio = source - count;
                    } else {
                        ratio = source * 100 / count;
                    }
                    if (ratio < lowestRatio) {
                        lowestRatio = ratio;
                        bestColor = color;
                    }
                }
            }
            final Card landCard = callback.getBestBasicLand(bestColor, setsToUse);
            Integer count = colorSource.get(bestColor.toString());
            count++;
            colorSource.put(bestColor.toString(), count);
            deck.getCards().add(landCard);
        }
    }
View Full Code Here

TOP

Related Classes of mage.Constants.ColoredManaSymbol

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.