MCPcopy Create free account
hub / github.com/Card-Forge/forge / PaperCard

Class PaperCard

forge-core/src/main/java/forge/item/PaperCard.java:38–650  ·  view source on GitHub ↗

A lightweight version of a card that matches real-world cards, to use outside of games (eg. inventory, decks, trade). The full set of rules is in the CardRules class. @author Forge

Source from the content-addressed store, hash-verified

36 * @author Forge
37 */
38public class PaperCard implements Comparable<IPaperCard>, InventoryItemFromSet, IPaperCard {
39 @Serial
40 private static final long serialVersionUID = 2942081982620691205L;
41
42 // Reference to rules
43 private transient CardRules rules;
44
45 // These fields are kinda PK for PrintedCard
46 private final String name;
47 private String edition;
48 /* [NEW] Attribute to store reference to CollectorNumber of each PaperCard.
49 By default the attribute is marked as "unset" so that it could be retrieved and set.
50 (see getCollectorNumber())
51 */
52 private String collectorNumber;
53 private String artist;
54 private final int artIndex;
55 private final boolean foil;
56 private final PaperCardFlags flags;
57 private final String functionalVariant;
58
59 // Calculated fields are below:
60 private transient CardRarity rarity; // rarity is given in ctor when set is assigned
61 // Reference to a new instance of Self, but foiled!
62 private transient PaperCard foiledVersion, noSellVersion, flaglessVersion;
63 private transient Boolean hasImage;
64 private transient String displayName;
65 private transient String sortableName;
66 private transient boolean hasFlavorName;
67
68 @Override
69 public String getName() {
70 return name;
71 }
72
73 @Override
74 public String getEdition() {
75 return edition;
76 }
77
78 @Override
79 public String getCollectorNumber() {
80 if (collectorNumber == null)
81 collectorNumber = IPaperCard.NO_COLLECTOR_NUMBER;
82 return collectorNumber;
83 }
84
85 @Override
86 public String getFunctionalVariant() {
87 return functionalVariant;
88 }
89
90 @Override
91 public ColorSet getMarkedColors() {
92 return this.flags.markedColors;
93 }
94
95 @Override

Callers

nothing calls this directly

Calls 1

Tested by

no test coverage detected