mirror of
https://github.com/magefree/mage.git
synced 2025-12-24 20:41:58 -08:00
Add additional ability icons (#10549)
* Slightly revamped basic card icons All icon classes which were just static text have been removed, and instead replaced with a static instance. A new icon for reach has been added Some icons have been reused for new abilities (hexproof for shroud and ward, infect for toxic) When a card would have two icons of the same type, the icons are instead combines into one with a combined hover tooltip. * Fixed missing capitalization on ward, hexproof
This commit is contained in:
parent
9e63858db6
commit
fae63d9d4b
42 changed files with 167 additions and 522 deletions
|
|
@ -175,7 +175,32 @@ public class CardIconsPanel extends JPanel {
|
|||
this.removeAll();
|
||||
if (newIcons != null) {
|
||||
this.icons.clear();
|
||||
this.icons.addAll(newIcons);
|
||||
TreeMap<CardIconType, List<CardIcon>> cardIconMap = new TreeMap<>();
|
||||
newIcons.forEach(icon -> cardIconMap.computeIfAbsent(icon.getIconType(), k -> new ArrayList<>()).add(icon));
|
||||
|
||||
for (Map.Entry<CardIconType, List<CardIcon>> entry : cardIconMap.entrySet()) {
|
||||
List<CardIcon> combined = entry.getValue()
|
||||
.stream()
|
||||
.filter(icon -> icon != null && icon.canBeCombined())
|
||||
.sorted(CardIconComparator.instance)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
if (combined.size() > 1) {
|
||||
entry.getValue().removeAll(combined);
|
||||
|
||||
String combinedHint = combined.stream()
|
||||
.map(CardIcon::getCombinedInfo)
|
||||
.collect(Collectors.joining("<br>"));
|
||||
|
||||
CardIcon combinedIcon = new CardIconImpl(entry.getKey(), combinedHint);
|
||||
|
||||
this.icons.add(combinedIcon);
|
||||
this.icons.addAll(entry.getValue());
|
||||
} else {
|
||||
this.icons.addAll(entry.getValue());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// auto-hide panel on empty icons
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
package org.mage.card.arcane;
|
||||
|
||||
import mage.abilities.icon.CardIconColor;
|
||||
import mage.abilities.icon.abilities.FlyingAbilityIcon;
|
||||
import mage.abilities.icon.CardIconImpl;
|
||||
import mage.utils.StreamUtils;
|
||||
import org.apache.batik.anim.dom.SVGDOMImplementation;
|
||||
import org.apache.batik.transcoder.TranscoderInput;
|
||||
|
|
@ -217,7 +217,8 @@ public class SvgUtils {
|
|||
public static boolean checkSvgSupport() {
|
||||
// usa sample icon for svg support testing
|
||||
// direct call, no needs in cache
|
||||
BufferedImage sampleImage = ImageManagerImpl.instance.getCardIcon(FlyingAbilityIcon.instance.getIconType().getResourceName(), 32, CardIconColor.DEFAULT);
|
||||
BufferedImage sampleImage = ImageManagerImpl.instance
|
||||
.getCardIcon(CardIconImpl.ABILITY_FLYING.getIconType().getResourceName(), 32, CardIconColor.DEFAULT);
|
||||
haveSvgSupport = (sampleImage != null && sampleImage.getWidth() > 0);
|
||||
if (!haveSvgSupport) {
|
||||
logger.warn("WARNING, your system doesn't support svg images, so card icons will be disabled. Please, make a bug report in the github.");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue