Added builder method to cards

This commit is contained in:
magenoxx 2012-06-29 10:03:20 +04:00
parent 533cc69101
commit 4de0bdec64
2 changed files with 12 additions and 9 deletions

View file

@ -298,7 +298,9 @@ public class Sets extends HashMap<String, ExpansionSet> {
public static Card createCard(Class clazz) { public static Card createCard(Class clazz) {
try { try {
Constructor<?> con = clazz.getConstructor(new Class[]{UUID.class}); Constructor<?> con = clazz.getConstructor(new Class[]{UUID.class});
return (Card) con.newInstance(new Object[] {null}); Card card = (Card) con.newInstance(new Object[] {null});
card.build();
return card;
} catch (Exception ex) { } catch (Exception ex) {
logger.fatal("Error creating card:" + clazz.getName(), ex); logger.fatal("Error creating card:" + clazz.getName(), ex);
return null; return null;

View file

@ -28,7 +28,6 @@
package mage.sets.riseoftheeldrazi; package mage.sets.riseoftheeldrazi;
import java.util.UUID;
import mage.Constants.CardType; import mage.Constants.CardType;
import mage.Constants.Rarity; import mage.Constants.Rarity;
import mage.abilities.dynamicvalue.common.StaticValue; import mage.abilities.dynamicvalue.common.StaticValue;
@ -36,30 +35,32 @@ import mage.abilities.effects.common.LookLibraryAndPickControllerEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.filter.FilterCard; import mage.filter.FilterCard;
import java.util.UUID;
/** /**
*
* @author LevelX * @author LevelX
*/ */
public class AncientStirrings extends CardImpl<AncientStirrings> { public class AncientStirrings extends CardImpl<AncientStirrings> {
private final static FilterCard filter = new FilterCard("colorless card"); private final static FilterCard filter = new FilterCard("colorless card");
static { static {
filter.setColorless(true); filter.setColorless(true);
filter.setUseColorless(true); filter.setUseColorless(true);
} }
public AncientStirrings (UUID ownerId) { public AncientStirrings(UUID ownerId) {
super(ownerId, 174, "Ancient Stirrings", Rarity.COMMON, new CardType[]{CardType.SORCERY}, "{G}"); super(ownerId, 174, "Ancient Stirrings", Rarity.COMMON, new CardType[]{CardType.SORCERY}, "{G}");
this.expansionSetCode = "ROE"; this.expansionSetCode = "ROE";
this.color.setGreen(true); this.color.setGreen(true);
// Look at the top five cards of your library. You may reveal a colorless card from among them and put it into your hand. // Look at the top five cards of your library. You may reveal a colorless card from among them and put it into your hand.
// Then put the rest on the bottom of your library in any order. (Cards with no colored mana in their mana costs are colorless. Lands are also colorless.) // Then put the rest on the bottom of your library in any order. (Cards with no colored mana in their mana costs are colorless. Lands are also colorless.)
this.getSpellAbility().addEffect(new LookLibraryAndPickControllerEffect(new StaticValue(5), false, new StaticValue(1), filter, false)); this.getSpellAbility().addEffect(new LookLibraryAndPickControllerEffect(new StaticValue(5), false, new StaticValue(1), filter, false));
} }
public AncientStirrings (final AncientStirrings card) { public AncientStirrings(final AncientStirrings card) {
super(card); super(card);
} }