fix supertype on the client

This commit is contained in:
ingmargoudt 2017-03-27 22:20:19 +02:00
parent 0879298e92
commit 5cd1b5880f
9 changed files with 64 additions and 117 deletions

View file

@ -33,52 +33,12 @@
*/
package mage.client.cards;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.RenderingHints;
import java.awt.event.ComponentEvent;
import java.awt.event.ComponentListener;
import java.awt.event.FocusEvent;
import java.awt.event.FocusListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener;
import java.awt.image.BufferedImage;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import javax.swing.JPanel;
import javax.swing.JPopupMenu;
import javax.swing.JScrollPane;
import javax.swing.Popup;
import javax.swing.PopupFactory;
import javax.swing.text.BadLocationException;
import javax.swing.text.Style;
import javax.swing.text.StyleConstants;
import javax.swing.text.StyleContext;
import javax.swing.text.StyledDocument;
import mage.cards.CardDimensions;
import mage.cards.MagePermanent;
import mage.cards.Sets;
import mage.cards.TextPopup;
import mage.cards.action.ActionCallback;
import mage.client.MageFrame;
import static mage.client.constants.Constants.CONTENT_MAX_XOFFSET;
import static mage.client.constants.Constants.FRAME_MAX_HEIGHT;
import static mage.client.constants.Constants.FRAME_MAX_WIDTH;
import static mage.client.constants.Constants.NAME_FONT_MAX_SIZE;
import static mage.client.constants.Constants.NAME_MAX_YOFFSET;
import static mage.client.constants.Constants.POWBOX_TEXT_MAX_LEFT;
import static mage.client.constants.Constants.POWBOX_TEXT_MAX_TOP;
import static mage.client.constants.Constants.SYMBOL_MAX_XOFFSET;
import static mage.client.constants.Constants.SYMBOL_MAX_YOFFSET;
import static mage.client.constants.Constants.TYPE_MAX_YOFFSET;
import mage.client.game.PlayAreaPanel;
import mage.client.util.Config;
import mage.client.util.DefaultActionCallback;
@ -86,13 +46,21 @@ import mage.client.util.ImageHelper;
import mage.client.util.gui.ArrowBuilder;
import mage.constants.CardType;
import mage.constants.EnlargeMode;
import mage.view.AbilityView;
import mage.view.CardView;
import mage.view.CounterView;
import mage.view.PermanentView;
import mage.view.StackAbilityView;
import mage.constants.SuperType;
import mage.view.*;
import org.apache.log4j.Logger;
import javax.swing.*;
import javax.swing.text.*;
import java.awt.*;
import java.awt.event.*;
import java.awt.image.BufferedImage;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import static mage.client.constants.Constants.*;
/**
*
* @author BetaSteward_at_googlemail.com
@ -300,7 +268,7 @@ public class Card extends MagePermanent implements MouseMotionListener, MouseLis
protected String getType(CardView card) {
StringBuilder sbType = new StringBuilder();
for (String superType : card.getSuperTypes()) {
for (SuperType superType : card.getSuperTypes()) {
sbType.append(superType).append(' ');
}

View file

@ -30,6 +30,7 @@ package mage.client.deckeditor.table;
import mage.constants.CardType;
import mage.cards.MageCard;
import mage.constants.SuperType;
import mage.view.CardView;
/**
@ -54,8 +55,8 @@ public final class CardHelper {
public static String getType(CardView c) {
StringBuilder type = new StringBuilder();
for (String superType : c.getSuperTypes()) {
type.append(superType);
for (SuperType superType : c.getSuperTypes()) {
type.append(superType.toString());
type.append(' ');
}
for (CardType cardType : c.getCardTypes()) {

View file

@ -1,23 +1,8 @@
package mage.client.util.gui;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.GraphicsConfiguration;
import java.awt.Insets;
import java.awt.Point;
import java.awt.Rectangle;
import java.util.ArrayList;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.SwingConstants;
import mage.client.MageFrame;
import mage.client.util.GUISizeHelper;
import mage.constants.CardType;
import mage.constants.MageObjectType;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.constants.*;
import mage.utils.CardUtil;
import mage.view.CardView;
import mage.view.CounterView;
@ -26,6 +11,10 @@ import org.jdesktop.swingx.JXPanel;
import org.mage.card.arcane.ManaSymbols;
import org.mage.card.arcane.UI;
import javax.swing.*;
import java.awt.*;
import java.util.ArrayList;
public final class GuiDisplayUtil {
private static final Font cardNameFont = new Font("Calibri", Font.BOLD, 15);
@ -360,8 +349,8 @@ public final class GuiDisplayUtil {
private static String getTypes(CardView card) {
String types = "";
for (String superType : card.getSuperTypes()) {
types += superType + ' ';
for (SuperType superType : card.getSuperTypes()) {
types += superType.toString() + ' ';
}
for (CardType cardType : card.getCardTypes()) {
types += cardType.toString() + ' ';

View file

@ -1,27 +1,5 @@
package org.mage.card.arcane;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.event.ActionListener;
import java.awt.event.ComponentEvent;
import java.awt.event.ComponentListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener;
import java.awt.event.MouseWheelEvent;
import java.awt.event.MouseWheelListener;
import java.awt.image.BufferedImage;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JPanel;
import javax.swing.JPopupMenu;
import mage.cards.MagePermanent;
import mage.cards.TextPopup;
import mage.cards.action.ActionCallback;
@ -31,6 +9,7 @@ import mage.client.plugins.impl.Plugins;
import mage.client.util.audio.AudioManager;
import mage.constants.CardType;
import mage.constants.EnlargeMode;
import mage.constants.SuperType;
import mage.view.AbilityView;
import mage.view.CardView;
import mage.view.PermanentView;
@ -38,6 +17,14 @@ import mage.view.StackAbilityView;
import org.apache.log4j.Logger;
import org.mage.plugins.card.utils.impl.ImageManagerImpl;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.awt.image.BufferedImage;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
/**
* Main class for drawing Mage card object.
*
@ -680,8 +667,8 @@ public abstract class CardPanel extends MagePermanent implements MouseListener,
protected final String getType(CardView card) {
StringBuilder sbType = new StringBuilder();
for (String superType : card.getSuperTypes()) {
sbType.append(superType).append(' ');
for (SuperType superType : card.getSuperTypes()) {
sbType.append(superType.toString()).append(' ');
}
for (CardType cardType : card.getCardTypes()) {

View file

@ -3,6 +3,7 @@ package org.mage.card.arcane;
import com.google.common.collect.MapMaker;
import mage.cards.action.ActionCallback;
import mage.constants.CardType;
import mage.constants.SuperType;
import mage.view.CardView;
import mage.view.CounterView;
import mage.view.PermanentView;
@ -157,7 +158,7 @@ public class CardPanelRenderImpl extends CardPanel {
for (CardType type : this.view.getCardTypes()) {
sb.append((char) type.ordinal());
}
for (String s : this.view.getSuperTypes()) {
for (SuperType s : this.view.getSuperTypes()) {
sb.append(s);
}
for (String s : this.view.getSubTypes()) {

View file

@ -5,23 +5,19 @@
*/
package org.mage.card.arcane;
import java.awt.BasicStroke;
import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.Paint;
import java.awt.Polygon;
import java.awt.image.BufferedImage;
import java.util.ArrayList;
import mage.client.dialog.PreferencesDialog;
import mage.constants.AbilityType;
import mage.constants.CardType;
import mage.constants.SuperType;
import mage.utils.CardUtil;
import mage.view.CardView;
import mage.view.CounterView;
import mage.view.PermanentView;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.util.ArrayList;
/**
* @author stravant@gmail.com
*
@ -379,7 +375,7 @@ public abstract class CardRenderer {
}
} else {
StringBuilder sbType = new StringBuilder();
for (String superType : cardView.getSuperTypes()) {
for (SuperType superType : cardView.getSuperTypes()) {
sbType.append(superType).append(' ');
}
for (CardType cardType : cardView.getCardTypes()) {

View file

@ -49,7 +49,7 @@
maxPasswordLength="100"
maxAiOpponents="15"
saveGameActivated="false"
authenticationActivated="true"
authenticationActivated="false"
googleAccount=""
mailgunApiKey="key-d93e81f19a9c9ed243ebb7cc9381385c"
mailgunDomain="sandbox401a433f30d445309a5e86b6c53f7812.mailgun.org"

View file

@ -31,11 +31,7 @@ import mage.MageObjectReference;
import mage.abilities.Ability;
import mage.abilities.effects.ContinuousEffectImpl;
import mage.cards.repository.CardRepository;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Layer;
import mage.constants.Outcome;
import mage.constants.SubLayer;
import mage.constants.*;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.game.permanent.token.Token;
@ -101,10 +97,9 @@ public class BecomesCreatureAttachedWithActivatedAbilityOrSpellEffect extends Co
switch (layer) {
case TypeChangingEffects_4:
if (sublayer == SubLayer.NA) {
for (String superType : token.getSupertype()) {
if (!permanentAttachedTo.getSupertype().contains(superType)) {
permanentAttachedTo.getSupertype().add(superType);
}
for (SuperType superType : token.getSuperType()) {
permanentAttachedTo.addSuperType(superType);
}
// card type
switch (loseType) {

View file

@ -5,11 +5,21 @@ package mage.constants;
*/
public enum SuperType {
BASIC,
ELITE,
LEGENDARY,
ONGOING,
SNOW,
WORLD
BASIC("Basic"),
ELITE("Elite"),
LEGENDARY("Legendary"),
ONGOING("Ongoing"),
SNOW("Snow"),
WORLD("World");
String text;
SuperType(String text){
this.text = text;
}
public String toString(){
return text;
}
}