Search in sources :

Example 11 with PermanentView

use of mage.view.PermanentView in project mage by magefree.

the class CardPanelRenderModeMTGO method cardViewEquals.

private static boolean cardViewEquals(CardView a, CardView b) {
    if (a == b) {
        return true;
    }
    if (a.getClass() != b.getClass()) {
        return false;
    }
    if (!a.getDisplayName().equals(b.getDisplayName())) {
        return false;
    }
    if (!a.getPower().equals(b.getPower())) {
        return false;
    }
    if (!a.getToughness().equals(b.getToughness())) {
        return false;
    }
    if (!a.getLoyalty().equals(b.getLoyalty())) {
        return false;
    }
    if (0 != a.getColor().compareTo(b.getColor())) {
        return false;
    }
    if (!a.getCardTypes().equals(b.getCardTypes())) {
        return false;
    }
    if (!a.getSubTypes().equals(b.getSubTypes())) {
        return false;
    }
    if (!a.getSuperTypes().equals(b.getSuperTypes())) {
        return false;
    }
    if (!a.getManaCostStr().equals(b.getManaCostStr())) {
        return false;
    }
    if (!a.getRules().equals(b.getRules())) {
        return false;
    }
    if (a.getRarity() == null || b.getRarity() == null) {
        return false;
    }
    if (a.getRarity() != b.getRarity()) {
        return false;
    }
    if (a.getCardNumber() != null && !a.getCardNumber().equals(b.getCardNumber())) {
        return false;
    }
    // Expansion set code, with null checking:
    // TODO: The null checks should not be necessary, but thanks to Issue #2260
    // some tokens / commandobjects will be missing expansion set codes.
    String expA = a.getExpansionSetCode();
    if (expA == null) {
        expA = "";
    }
    String expB = b.getExpansionSetCode();
    if (expB == null) {
        expB = "";
    }
    if (!expA.equals(expB)) {
        return false;
    }
    if (a.getFrameStyle() != b.getFrameStyle()) {
        return false;
    }
    if (a.getCounters() == null) {
        if (b.getCounters() != null) {
            return false;
        }
    } else if (!a.getCounters().equals(b.getCounters())) {
        return false;
    }
    if (a.isFaceDown() != b.isFaceDown()) {
        return false;
    }
    if ((a instanceof PermanentView)) {
        PermanentView aa = (PermanentView) a;
        PermanentView bb = (PermanentView) b;
        if (aa.hasSummoningSickness() != bb.hasSummoningSickness()) {
            // are the same for a and b
            return false;
        }
        return aa.getDamage() == bb.getDamage();
    }
    return true;
}
Also used : PermanentView(mage.view.PermanentView)

Aggregations

PermanentView (mage.view.PermanentView)11 Point (java.awt.Point)4 MageCard (mage.cards.MageCard)4 UUID (java.util.UUID)3 BufferedImage (java.awt.image.BufferedImage)2 AttributedString (java.text.AttributedString)2 CounterView (mage.view.CounterView)2 Dimension (java.awt.Dimension)1 java.util (java.util)1 Entry (java.util.Map.Entry)1 JLayeredPane (javax.swing.JLayeredPane)1 ObjectColor (mage.ObjectColor)1 MagePermanent (mage.cards.MagePermanent)1 MageComponents (mage.client.components.MageComponents)1 CardView (mage.view.CardView)1