mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 04:08:01 +00:00
Merge branch 'newBranch' into 'master'
[Mobile] Update some GUI Elements See merge request core-developers/forge!3255
This commit is contained in:
@@ -1,11 +1,15 @@
|
||||
package forge.deck;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import forge.card.CardSplitType;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import com.google.common.base.Function;
|
||||
@@ -260,6 +264,29 @@ public class DeckProxy implements InventoryItem {
|
||||
return highestRarity;
|
||||
}
|
||||
|
||||
public PaperCard getHighestCMCCard() {
|
||||
PaperCard key = null;
|
||||
Map<PaperCard, Integer> keyCMC = new HashMap<>(64);
|
||||
|
||||
for (final Entry <PaperCard, Integer> pc : getDeck().getAllCardsInASinglePool()) {
|
||||
if (pc.getKey().getRules().getManaCost() != null) {
|
||||
if (pc.getKey().getRules().getSplitType() != CardSplitType.Split)
|
||||
keyCMC.put(pc.getKey(),pc.getKey().getRules().getManaCost().getCMC());
|
||||
}
|
||||
}
|
||||
|
||||
if (!keyCMC.isEmpty()) {
|
||||
int max = Collections.max(keyCMC.values());
|
||||
//get any max cmc
|
||||
for (Entry<PaperCard, Integer> entry : keyCMC.entrySet()) {
|
||||
if (entry.getValue()==max) {
|
||||
return entry.getKey();
|
||||
}
|
||||
}
|
||||
}
|
||||
return key;
|
||||
}
|
||||
|
||||
public Set<GameFormat> getFormats() {
|
||||
if (formats == null) {
|
||||
formats = FModel.getFormats().getAllFormatsOfDeck(getDeck());
|
||||
|
||||
@@ -100,6 +100,7 @@ public final class ForgeConstants {
|
||||
public static final String SPRITE_ABILITY_FILE = "sprite_ability.png";
|
||||
public static final String SPRITE_BORDER_FILE = "sprite_border.png";
|
||||
public static final String SPRITE_BUTTONS_FILE = "sprite_buttons.png";
|
||||
public static final String SPRITE_DECKBOX_FILE = "sprite_deckbox.png";
|
||||
public static final String SPRITE_START_FILE = "sprite_start.png";
|
||||
public static final String SPRITE_MANAICONS_FILE = "sprite_manaicons.png";
|
||||
public static final String SPRITE_AVATARS_FILE = "sprite_avatars.png";
|
||||
|
||||
Reference in New Issue
Block a user