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

Method addCard

forge-game/src/main/java/forge/game/GameState.java:249–451  ·  view source on GitHub ↗
(ZoneType zoneType, Map<ZoneType, String> cardTexts, Card c)

Source from the content-addressed store, hash-verified

247 }
248
249 private void addCard(ZoneType zoneType, Map<ZoneType, String> cardTexts, Card c) {
250 StringBuilder newText = new StringBuilder(cardTexts.get(zoneType));
251 if (newText.length() > 0) {
252 newText.append(";");
253 }
254 if (c.isToken()) {
255 newText.append("t:").append(new TokenInfo(c));
256 } else {
257 if (c.getPaperCard() == null) {
258 return;
259 }
260
261 if (c.hasMergedCard()) {
262 String suffix = c.getTopMergedCard().hasPaperFoil() ? "+" : "";
263 // we have to go by the current top card name here
264 newText.append(c.getTopMergedCard().getPaperCard().getName()).append(suffix).append("|Set:")
265 .append(c.getTopMergedCard().getPaperCard().getEdition()).append("|Art:")
266 .append(c.getTopMergedCard().getPaperCard().getArtIndex());
267 } else {
268 String suffix = c.hasPaperFoil() ? "+" : "";
269 newText.append(c.getPaperCard().getName()).append(suffix).append("|Set:").append(c.getPaperCard().getEdition())
270 .append("|Art:").append(c.getPaperCard().getArtIndex());
271 }
272 }
273 if (c.isCommander()) {
274 newText.append("|IsCommander");
275 }
276 if (c.isRingBearer()) {
277 newText.append("|IsRingBearer");
278 }
279
280 if (cardsReferencedByID.contains(c)) {
281 newText.append("|Id:").append(c.getId());
282 }
283
284 if (zoneType == ZoneType.Battlefield) {
285 if (c.getOwner() != c.getController()) {
286 newText.append("|Owner:").append(getPlayerString(c.getOwner()));
287 }
288 if (c.isTapped()) {
289 newText.append("|Tapped");
290 }
291 if (c.isSick()) {
292 newText.append("|SummonSick");
293 }
294 if (c.isRenowned()) {
295 newText.append("|Renowned");
296 }
297 if (c.isSolved()) {
298 newText.append("|Solved");
299 }
300 if (c.isSuspected()) {
301 newText.append("|Suspected");
302 }
303 if (c.isMonstrous()) {
304 newText.append("|Monstrous");
305 }
306 if (c.isPhasedOut()) {

Callers 1

initFromGameMethod · 0.95

Calls 15

getPlayerStringMethod · 0.95
joinMethod · 0.95
countersToStringMethod · 0.95
getIdMethod · 0.95
lengthMethod · 0.80
hasMergedCardMethod · 0.80
getTopMergedCardMethod · 0.80
isRenownedMethod · 0.80
isSuspectedMethod · 0.80
isMonstrousMethod · 0.80
getPhasedOutMethod · 0.80
isManifestedMethod · 0.80

Tested by

no test coverage detected