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

Method getNameToUse

forge-core/src/main/java/forge/util/ImageUtil.java:157–199  ·  view source on GitHub ↗
(IPaperCard cp, String face)

Source from the content-addressed store, hash-verified

155 }
156
157 public static String getNameToUse(IPaperCard cp, String face) {
158 final CardRules card = cp.getRules();
159 if (face.equals("back")) {
160 if (cp.hasBackFace())
161 if (card.getOtherPart() != null) {
162 return card.getOtherPart().getName();
163 } else if (!card.getMeldWith().isEmpty()) {
164 final CardDb db = StaticData.instance().getCommonCards();
165 return db.getRulesOrElseUnsupported(card.getMeldWith()).getOtherPart().getName();
166 } else {
167 return null;
168 }
169 else
170 return null;
171 } else if (face.equals("white")) {
172 if (card.getWSpecialize() != null) {
173 return card.getWSpecialize().getName();
174 }
175 } else if (face.equals("blue")) {
176 if (card.getUSpecialize() != null) {
177 return card.getUSpecialize().getName();
178 }
179 } else if (face.equals("black")) {
180 if (card.getBSpecialize() != null) {
181 return card.getBSpecialize().getName();
182 }
183 } else if (face.equals("red")) {
184 if (card.getRSpecialize() != null) {
185 return card.getRSpecialize().getName();
186 }
187 } else if (face.equals("green")) {
188 if (card.getGSpecialize() != null) {
189 return card.getGSpecialize().getName();
190 }
191 } else if (CardSplitType.Split == cp.getRules().getSplitType()) {
192 return card.getMainPart().getName() + card.getOtherPart().getName();
193 } else if (cp.hasFlavorName()) {
194 return cp.getDisplayName();
195 } else if (!IPaperCard.NO_FUNCTIONAL_VARIANT.equals(cp.getFunctionalVariant())) {
196 return cp.getName() + " " + cp.getFunctionalVariant();
197 }
198 return cp.getName();
199 }
200
201 public static String getImageKey(IPaperCard cp, String face, boolean includeSet) {
202 return getImageRelativePath(cp, face, includeSet, false);

Callers 1

getImageRelativePathMethod · 0.95

Calls 15

getOtherPartMethod · 0.95
getMeldWithMethod · 0.95
instanceMethod · 0.95
getWSpecializeMethod · 0.95
getUSpecializeMethod · 0.95
getBSpecializeMethod · 0.95
getRSpecializeMethod · 0.95
getGSpecializeMethod · 0.95
getMainPartMethod · 0.95
getCommonCardsMethod · 0.80
getSplitTypeMethod · 0.80

Tested by

no test coverage detected