public static Card createCard(Class<?> clazz, CardSetInfo setInfo, List<String> errorList) { String setCode = null; try { Card card; if (setInfo == null) { Constructor<?> con = clazz.getConstructor(UUID.class); card = (Card) con.newInstance(new Object[]{null}); } else { setCode = setInfo.getExpansionSetCode(); Constructor<?> con = clazz.getConstructor(UUID.class, CardSetInfo.class); card = (Card) con.newInstance(null, setInfo); } return card; } catch (Exception e) { String err = "Error loading card: " + clazz.getCanonicalName() + " (" + setCode + ")"; if (errorList != null) { errorList.add(err); } if (e instanceof InvocationTargetException) { logger.fatal(err, ((InvocationTargetException) e).getTargetException()); } else { logger.fatal(err, e); } return null; } }
public SplitCard(UUID ownerId, CardSetInfo setInfo, CardType[] typesLeft, CardType[] typesRight, String costsLeft, String costsRight, SpellAbilityType spellAbilityType) { super(ownerId, setInfo, CardType.mergeTypes(typesLeft, typesRight), costsLeft + costsRight, spellAbilityType); String[] names = setInfo.getName().split(" // "); leftHalfCard = new SplitCardHalfImpl(this.getOwnerId(), new CardSetInfo(names[0], setInfo.getExpansionSetCode(), setInfo.getCardNumber(), setInfo.getRarity(), setInfo.getGraphicInfo()), typesLeft, costsLeft, this, SpellAbilityType.SPLIT_LEFT); rightHalfCard = new SplitCardHalfImpl(this.getOwnerId(), new CardSetInfo(names[1], setInfo.getExpansionSetCode(), setInfo.getCardNumber(), setInfo.getRarity(), setInfo.getGraphicInfo()), typesRight, costsRight, this, SpellAbilityType.SPLIT_RIGHT); this.splitCard = true; }
this.rarity = setInfo.getRarity(); this.cardNumber = setInfo.getCardNumber(); this.expansionSetCode = setInfo.getExpansionSetCode(); this.cardType.addAll(Arrays.asList(cardTypes)); this.manaCost.load(costs);