Search in sources :

Example 1 with CardIcon

use of mage.abilities.icon.CardIcon in project mage by magefree.

the class ClassReminderAbility method getIcons.

@Override
public List<CardIcon> getIcons(Game game) {
    if (game == null) {
        return this.icons;
    }
    // dynamic GUI icon with current level
    List<CardIcon> res = new ArrayList<>();
    Permanent permanent = this.getSourcePermanentOrLKI(game);
    if (permanent == null) {
        return res;
    }
    CardIcon levelIcon = new CardIconImpl(CardIconType.ABILITY_CLASS_LEVEL, "Current class level: " + permanent.getClassLevel(), String.valueOf(permanent.getClassLevel()));
    res.add(levelIcon);
    return res;
}
Also used : Permanent(mage.game.permanent.Permanent) CardIconImpl(mage.abilities.icon.CardIconImpl) ArrayList(java.util.ArrayList) CardIcon(mage.abilities.icon.CardIcon)

Example 2 with CardIcon

use of mage.abilities.icon.CardIcon in project mage by magefree.

the class MageLayer method updateCardIcons.

private void updateCardIcons(CardView card) {
    Map<CardIconsPanel, List<CardIcon>> newIcons = new HashMap<>();
    this.iconsPanels.forEach(panel -> newIcons.put(panel, new ArrayList<>()));
    List<CardIcon> allIcons = new ArrayList<>();
    // main icons
    allIcons.addAll(card.getCardIcons());
    // playable icons
    if (card.getPlayableStats().getPlayableImportantAmount() > 0) {
        allIcons.add(new PlayableCountIcon(card.getPlayableStats()));
    }
    // create panels
    allIcons.forEach(cardIcon -> {
        CardIconCategory category = cardIcon.getIconType().getCategory();
        // debug panel must take all icons (position depends on render settings)
        if (iconsDebugPanel != null) {
            newIcons.get(iconsDebugPanel).add(cardIcon);
        }
        // playable panel (bottom left corner)
        if (iconsPlayablePanel != null && category == CardIconCategory.PLAYABLE_COUNT) {
            newIcons.get(iconsPlayablePanel).add(cardIcon);
        }
        // abilities panel (left side)
        if (iconsAbilitiesPanel != null && category == CardIconCategory.ABILITY) {
            newIcons.get(iconsAbilitiesPanel).add(cardIcon);
        }
        // commander panel (top center)
        if (iconsCommanderPanel != null && category == CardIconCategory.COMMANDER) {
            newIcons.get(iconsCommanderPanel).add(cardIcon);
        }
    });
    this.iconsPanels.forEach(panel -> panel.updateIcons(newIcons.get(panel)));
}
Also used : HashMap(java.util.HashMap) CardIconsPanel(mage.client.cards.CardIconsPanel) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List) PlayableCountIcon(mage.abilities.icon.system.PlayableCountIcon) CardIcon(mage.abilities.icon.CardIcon) CardIconCategory(mage.abilities.icon.CardIconCategory)

Aggregations

ArrayList (java.util.ArrayList)2 CardIcon (mage.abilities.icon.CardIcon)2 HashMap (java.util.HashMap)1 List (java.util.List)1 CardIconCategory (mage.abilities.icon.CardIconCategory)1 CardIconImpl (mage.abilities.icon.CardIconImpl)1 PlayableCountIcon (mage.abilities.icon.system.PlayableCountIcon)1 CardIconsPanel (mage.client.cards.CardIconsPanel)1 Permanent (mage.game.permanent.Permanent)1