mirror of
https://github.com/magefree/mage.git
synced 2026-01-26 21:29:17 -08:00
Remove use of card classes for duplicate cards. Remove set related information from being tied to card classes.
This commit is contained in:
parent
3c2189e7a1
commit
e8230946af
32 changed files with 356 additions and 155 deletions
|
|
@ -43,7 +43,7 @@ public class CommanderAnthology extends ExpansionSet {
|
|||
}
|
||||
|
||||
private CommanderAnthology() {
|
||||
super("Commander Anthology", "CMA", "mage.sets.commanderanthology", new GregorianCalendar(2017, 6, 9).getTime(), SetType.SUPPLEMENTAL);
|
||||
super("Commander Anthology", "CMA2", "mage.sets.commanderanthology", new GregorianCalendar(2017, 6, 9).getTime(), SetType.SUPPLEMENTAL);
|
||||
this.blockName = "Commander Anthology";
|
||||
this.hasBasicLands = false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,7 +27,6 @@
|
|||
*/
|
||||
package mage.sets.eldritchmoon;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.MageObject;
|
||||
import mage.abilities.Ability;
|
||||
|
|
@ -37,26 +36,28 @@ import mage.abilities.keyword.FirstStrikeAbility;
|
|||
import mage.abilities.keyword.FlyingAbility;
|
||||
import mage.abilities.keyword.LifelinkAbility;
|
||||
import mage.abilities.keyword.VigilanceAbility;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.cards.MeldCard;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.Zone;
|
||||
import mage.constants.*;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.events.GameEvent.EventType;
|
||||
import mage.game.stack.Spell;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public class BriselaVoiceOfNightmares extends MeldCard {
|
||||
|
||||
// TODO: EJM - Remove this
|
||||
public BriselaVoiceOfNightmares(UUID ownerId) {
|
||||
super(ownerId, 15, "Brisela, Voice of Nightmares", Rarity.MYTHIC, new CardType[]{CardType.CREATURE}, "");
|
||||
this.expansionSetCode = "EMN";
|
||||
this(ownerId, new CardSetInfo("Brisela, Voice of Nightmares", "EMN", "15", Rarity.MYTHIC));
|
||||
}
|
||||
|
||||
public BriselaVoiceOfNightmares(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "");
|
||||
this.supertype.add("Legendary");
|
||||
this.subtype.add("Eldrazi");
|
||||
this.subtype.add("Angel");
|
||||
|
|
|
|||
|
|
@ -27,7 +27,6 @@
|
|||
*/
|
||||
package mage.sets.eldritchmoon;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||
|
|
@ -36,21 +35,27 @@ import mage.abilities.effects.common.continuous.BoostControlledEffect;
|
|||
import mage.abilities.effects.common.continuous.GainAbilityAllEffect;
|
||||
import mage.abilities.keyword.HasteAbility;
|
||||
import mage.abilities.keyword.MenaceAbility;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.cards.MeldCard;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Rarity;
|
||||
import mage.filter.common.FilterControlledCreaturePermanent;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public class ChitteringHost extends MeldCard {
|
||||
|
||||
// TODO: EJM - Remove this
|
||||
public ChitteringHost(UUID ownerId) {
|
||||
super(ownerId, 96, "Chittering Host", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "");
|
||||
this.expansionSetCode = "EMN";
|
||||
this(ownerId, new CardSetInfo("Chittering Host", "EMN", "96", Rarity.COMMON));
|
||||
}
|
||||
|
||||
public ChitteringHost(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "");
|
||||
this.subtype.add("Eldrazi");
|
||||
this.subtype.add("Horror");
|
||||
this.power = new MageInt(5);
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ import mage.abilities.keyword.FirstStrikeAbility;
|
|||
import mage.abilities.keyword.FlyingAbility;
|
||||
import mage.abilities.keyword.LifelinkAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.TargetController;
|
||||
|
|
@ -67,7 +68,10 @@ public class GiselaTheBrokenBlade extends CardImpl {
|
|||
|
||||
// At the beginning of your end step, if you both own and control Gisela, the Broken Blade and a creature named Bruna, the Fading Light, exile them, then meld them into Brisela, Voice of Nightmares.
|
||||
this.addAbility(new ConditionalTriggeredAbility(
|
||||
new BeginningOfEndStepTriggeredAbility(new MeldEffect("Bruna, the Fading Light", new BriselaVoiceOfNightmares(ownerId)), TargetController.YOU, false),
|
||||
new BeginningOfEndStepTriggeredAbility(
|
||||
new MeldEffect("Bruna, the Fading Light",
|
||||
new BriselaVoiceOfNightmares(ownerId,
|
||||
new CardSetInfo("Brisela, Voice of Nightmares", "EMN", "15", Rarity.MYTHIC))), TargetController.YOU, false),
|
||||
new MeldCondition("Bruna, the Fading Light"),
|
||||
"At the beginning of your end step, if you both own and control {this} and a creature named Bruna, the Fading Light, exile them, "
|
||||
+ "then meld them into Brisela, Voice of Nightmares."));
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@ import mage.abilities.condition.common.MeldCondition;
|
|||
import mage.abilities.decorator.ConditionalTriggeredAbility;
|
||||
import mage.abilities.effects.common.MeldEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.TargetController;
|
||||
|
|
@ -54,7 +55,7 @@ public class GrafRats extends CardImpl {
|
|||
// At the beginning of combat on your turn, if you both own and control Graf Rats and a creature named Midnight Scavengers, exile them, then meld them into Chittering Host.
|
||||
|
||||
this.addAbility(new ConditionalTriggeredAbility(
|
||||
new BeginningOfCombatTriggeredAbility(new MeldEffect("Midnight Scavengers", new ChitteringHost(ownerId)), TargetController.YOU, false),
|
||||
new BeginningOfCombatTriggeredAbility(new MeldEffect("Midnight Scavengers", new ChitteringHost(ownerId, new CardSetInfo("Chittering Host", "EMN", "96", Rarity.COMMON))), TargetController.YOU, false),
|
||||
new MeldCondition("Midnight Scavengers"),
|
||||
"At the beginning of combat on your turn, if you both own and control {this} and a creature named Midnight Scavengers, exile them, then meld them into Chittering Host."));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,7 +27,6 @@
|
|||
*/
|
||||
package mage.sets.eldritchmoon;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
import mage.abilities.condition.common.MeldCondition;
|
||||
|
|
@ -39,12 +38,15 @@ import mage.abilities.effects.common.continuous.GainAbilityTargetEffect;
|
|||
import mage.abilities.keyword.HasteAbility;
|
||||
import mage.abilities.mana.ColorlessManaAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.Zone;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
|
|
@ -64,7 +66,9 @@ public class HanweirBattlements extends CardImpl {
|
|||
this.addAbility(ability);
|
||||
|
||||
// {3}{R}{R},{T}: If you both own and control Hanweir Battlements and a creature named Hanweir Garrison, exile them, then meld them into Hanweir, the Writhing Township.
|
||||
ability = new ConditionalActivatedAbility(Zone.BATTLEFIELD, new MeldEffect("Hanweir Garrison", new HanweirTheWrithingTownship(ownerId)),
|
||||
ability = new ConditionalActivatedAbility(Zone.BATTLEFIELD,
|
||||
new MeldEffect("Hanweir Garrison",
|
||||
new HanweirTheWrithingTownship(ownerId, new CardSetInfo("Hanweir, the Writhing Township", "EMN", "130", Rarity.RARE))),
|
||||
new ManaCostsImpl("{3}{R}{R}"), new MeldCondition("Hanweir Garrison"),
|
||||
"{3}{R}{R}, {T}: If you both own and control {this} and a creature named Hanweir Garrison, exile them, then meld them into Hanweir, the Writhing Township.");
|
||||
ability.addCost(new TapSourceCost());
|
||||
|
|
|
|||
|
|
@ -27,26 +27,31 @@
|
|||
*/
|
||||
package mage.sets.eldritchmoon;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.common.AttacksTriggeredAbility;
|
||||
import mage.abilities.effects.common.CreateTokenEffect;
|
||||
import mage.abilities.keyword.HasteAbility;
|
||||
import mage.abilities.keyword.TrampleAbility;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.cards.MeldCard;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Rarity;
|
||||
import mage.game.permanent.token.EldraziHorrorToken;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public class HanweirTheWrithingTownship extends MeldCard {
|
||||
|
||||
// TODO: EJM - Remove this
|
||||
public HanweirTheWrithingTownship(UUID ownerId) {
|
||||
super(ownerId, 130, "Hanweir, the Writhing Township", Rarity.RARE, new CardType[]{CardType.CREATURE}, "");
|
||||
this.expansionSetCode = "EMN";
|
||||
this(ownerId, new CardSetInfo("Hanweir, the Writhing Township", "EMN", "130", Rarity.RARE));
|
||||
}
|
||||
|
||||
public HanweirTheWrithingTownship(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "");
|
||||
this.supertype.add("Legendary");
|
||||
this.subtype.add("Eldrazi");
|
||||
this.subtype.add("Ooze");
|
||||
|
|
|
|||
|
|
@ -28,35 +28,17 @@
|
|||
package mage.sets.izzetvsgolgari;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.common.DiesCreatureTriggeredAbility;
|
||||
import mage.abilities.effects.common.CreateTokenEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.TargetController;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.filter.predicate.Predicates;
|
||||
import mage.filter.predicate.permanent.ControllerPredicate;
|
||||
import mage.filter.predicate.permanent.TokenPredicate;
|
||||
import mage.game.permanent.token.SaprolingToken;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author markedagain
|
||||
*/
|
||||
public class GolgariGermination extends CardImpl {
|
||||
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("nontoken creature you control");
|
||||
public class GolgariGermination extends mage.sets.ravnica.GolgariGermination {
|
||||
|
||||
static {
|
||||
filter.add(new ControllerPredicate(TargetController.YOU));
|
||||
filter.add(Predicates.not(new TokenPredicate()));
|
||||
}
|
||||
public GolgariGermination(UUID ownerId) {
|
||||
super(ownerId, 70, "Golgari Germination", Rarity.UNCOMMON, new CardType[]{CardType.ENCHANTMENT}, "{1}{B}{G}");
|
||||
super(ownerId);
|
||||
this.cardNumber = "70";
|
||||
this.expansionSetCode = "DDJ";
|
||||
|
||||
// Whenever a nontoken creature you control dies, put a 1/1 green Saproling creature token onto the battlefield.
|
||||
this.addAbility(new DiesCreatureTriggeredAbility(new CreateTokenEffect(new SaprolingToken()),false,filter));
|
||||
}
|
||||
|
||||
public GolgariGermination(final GolgariGermination card) {
|
||||
|
|
|
|||
|
|
@ -29,11 +29,6 @@
|
|||
package mage.sets.magic2010;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Rarity;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.keyword.FlyingAbility;
|
||||
import mage.cards.CardImpl;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
|
|||
|
|
@ -1,8 +1,12 @@
|
|||
package org.mage.test.utils;
|
||||
|
||||
import mage.MageInt;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.cards.basiclands.Island;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.repository.CardInfo;
|
||||
import mage.cards.repository.CardRepository;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.ColoredManaSymbol;
|
||||
import mage.constants.Rarity;
|
||||
|
|
@ -15,7 +19,6 @@ import java.util.ArrayList;
|
|||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import mage.sets.unhinged.Island;
|
||||
|
||||
|
||||
/**
|
||||
|
|
@ -39,7 +42,7 @@ public class DeckBuilderTest {
|
|||
@Override
|
||||
public Card getBestBasicLand(ColoredManaSymbol color, List<String> setsToUse) {
|
||||
Assert.assertNotNull(color);
|
||||
return new Island(owner);
|
||||
return new Island(owner, new CardSetInfo("Island", "MRD", "999", Rarity.LAND));
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -54,7 +57,7 @@ public class DeckBuilderTest {
|
|||
private static class RandomArtifactCreature extends CardImpl {
|
||||
|
||||
public RandomArtifactCreature(UUID ownerId, int cardNumber, String name) {
|
||||
super(ownerId, cardNumber, name, Rarity.COMMON, new CardType[]{CardType.ARTIFACT, CardType.CREATURE}, "{1}");
|
||||
super(ownerId, new CardSetInfo(name, "MRD", String.valueOf(cardNumber), Rarity.COMMON), new CardType[]{CardType.ARTIFACT, CardType.CREATURE}, "{1}");
|
||||
this.expansionSetCode = "MRD";
|
||||
this.power = new MageInt(1);
|
||||
this.toughness = new MageInt(1);
|
||||
|
|
|
|||
|
|
@ -0,0 +1,31 @@
|
|||
package mage.abilities.effects.common.combat;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.TurnPhase;
|
||||
import mage.game.Game;
|
||||
import mage.game.turn.TurnMod;
|
||||
|
||||
class AdditionalCombatPhaseEffect extends OneShotEffect {
|
||||
|
||||
public AdditionalCombatPhaseEffect() {
|
||||
super(Outcome.Benefit);
|
||||
staticText = "After this phase, there is an additional combat phase";
|
||||
}
|
||||
|
||||
public AdditionalCombatPhaseEffect(final AdditionalCombatPhaseEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AdditionalCombatPhaseEffect copy() {
|
||||
return new AdditionalCombatPhaseEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
game.getState().getTurnMods().add(new TurnMod(source.getControllerId(), TurnPhase.COMBAT, null, false));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
25
Mage/src/main/java/mage/cards/CardGraphicInfo.java
Normal file
25
Mage/src/main/java/mage/cards/CardGraphicInfo.java
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
package mage.cards;
|
||||
|
||||
import mage.ObjectColor;
|
||||
|
||||
public final class CardGraphicInfo {
|
||||
private final ObjectColor frameColor;
|
||||
private final FrameStyle frameStyle;
|
||||
private final boolean useVariousArt;
|
||||
|
||||
public CardGraphicInfo(FrameStyle frameStyle, boolean useVariousArt) {
|
||||
this(null, frameStyle, useVariousArt);
|
||||
}
|
||||
|
||||
public CardGraphicInfo(ObjectColor frameColor, FrameStyle frameStyle, boolean useVariousArt) {
|
||||
this.frameColor = frameColor;
|
||||
this.frameStyle = frameStyle;
|
||||
this.useVariousArt = useVariousArt;
|
||||
}
|
||||
|
||||
public ObjectColor getFrameColor() { return this.frameColor != null ? this.frameColor.copy() : null; }
|
||||
|
||||
public FrameStyle getFrameStyle() { return this.frameStyle; }
|
||||
|
||||
public boolean getUsesVariousArt() { return this.useVariousArt; }
|
||||
}
|
||||
|
|
@ -72,6 +72,7 @@ public abstract class CardImpl extends MageObjectImpl implements Card {
|
|||
protected String tokenDescriptor;
|
||||
protected Rarity rarity;
|
||||
protected boolean transformable;
|
||||
protected Class<?> secondSideCardClazz;
|
||||
protected Card secondSideCard;
|
||||
protected boolean nightCard;
|
||||
protected SpellAbility spellAbility;
|
||||
|
|
@ -81,18 +82,15 @@ public abstract class CardImpl extends MageObjectImpl implements Card {
|
|||
protected boolean splitCard;
|
||||
protected boolean morphCard;
|
||||
|
||||
public CardImpl(UUID ownerId, int cardNumber, String name, Rarity rarity, CardType[] cardTypes, String costs) {
|
||||
this(ownerId, String.valueOf(cardNumber), name, rarity, cardTypes, costs, SpellAbilityType.BASE);
|
||||
public CardImpl(UUID ownerId, CardSetInfo setInfo, CardType[] cardTypes, String costs) {
|
||||
this(ownerId, setInfo, cardTypes, costs, SpellAbilityType.BASE);
|
||||
}
|
||||
|
||||
public CardImpl(UUID ownerId, String cardNumber, String name, Rarity rarity, CardType[] cardTypes, String costs) {
|
||||
this(ownerId, cardNumber, name, rarity, cardTypes, costs, SpellAbilityType.BASE);
|
||||
}
|
||||
|
||||
public CardImpl(UUID ownerId, String cardNumber, String name, Rarity rarity, CardType[] cardTypes, String costs, SpellAbilityType spellAbilityType) {
|
||||
this(ownerId, name);
|
||||
this.rarity = rarity;
|
||||
this.cardNumber = cardNumber;
|
||||
public CardImpl(UUID ownerId, CardSetInfo setInfo, CardType[] cardTypes, String costs, SpellAbilityType spellAbilityType) {
|
||||
this(ownerId, setInfo.getName());
|
||||
this.rarity = setInfo.getRarity();
|
||||
this.cardNumber = setInfo.getCardNumber();
|
||||
this.expansionSetCode = setInfo.getExpansionSetCode();
|
||||
this.cardType.addAll(Arrays.asList(cardTypes));
|
||||
this.manaCost.load(costs);
|
||||
setDefaultColor();
|
||||
|
|
@ -108,7 +106,18 @@ public abstract class CardImpl extends MageObjectImpl implements Card {
|
|||
ability.setSourceId(this.getId());
|
||||
abilities.add(ability);
|
||||
}
|
||||
this.usesVariousArt = Character.isDigit(this.getClass().getName().charAt(this.getClass().getName().length() - 1));
|
||||
|
||||
CardGraphicInfo graphicInfo = setInfo.getGraphicInfo();
|
||||
if (graphicInfo != null) {
|
||||
this.usesVariousArt = graphicInfo.getUsesVariousArt();
|
||||
if (graphicInfo.getFrameColor() != null) {
|
||||
this.frameColor = graphicInfo.getFrameColor().copy();
|
||||
}
|
||||
if (graphicInfo.getFrameStyle() != null) {
|
||||
this.frameStyle = graphicInfo.getFrameStyle();
|
||||
}
|
||||
}
|
||||
|
||||
this.morphCard = false;
|
||||
}
|
||||
|
||||
|
|
@ -141,7 +150,7 @@ public abstract class CardImpl extends MageObjectImpl implements Card {
|
|||
|
||||
transformable = card.transformable;
|
||||
if (transformable) {
|
||||
secondSideCard = card.secondSideCard;
|
||||
secondSideCardClazz = card.secondSideCardClazz;
|
||||
nightCard = card.nightCard;
|
||||
}
|
||||
flipCard = card.flipCard;
|
||||
|
|
@ -157,12 +166,12 @@ public abstract class CardImpl extends MageObjectImpl implements Card {
|
|||
this.abilities.setSourceId(objectId);
|
||||
}
|
||||
|
||||
public static Card createCard(String name) {
|
||||
public static Card createCard(String name, CardSetInfo setInfo) {
|
||||
try {
|
||||
return createCard(Class.forName(name));
|
||||
return createCard(Class.forName(name), setInfo);
|
||||
} catch (ClassNotFoundException ex) {
|
||||
try {
|
||||
return createCard(PluginClassloaderRegistery.forName(name));
|
||||
return createCard(PluginClassloaderRegistery.forName(name), setInfo);
|
||||
} catch (ClassNotFoundException ex2) {
|
||||
// ignored
|
||||
}
|
||||
|
|
@ -171,10 +180,17 @@ public abstract class CardImpl extends MageObjectImpl implements Card {
|
|||
}
|
||||
}
|
||||
|
||||
public static Card createCard(Class<?> clazz) {
|
||||
public static Card createCard(Class<?> clazz, CardSetInfo setInfo) {
|
||||
try {
|
||||
Constructor<?> con = clazz.getConstructor(new Class[]{UUID.class});
|
||||
Card card = (Card) con.newInstance(new Object[]{null});
|
||||
Card card;
|
||||
if (setInfo == null) {
|
||||
Constructor<?> con = clazz.getConstructor(UUID.class);
|
||||
card = (Card) con.newInstance(new Object[]{null});
|
||||
}
|
||||
else {
|
||||
Constructor<?> con = clazz.getConstructor(UUID.class, CardSetInfo.class);
|
||||
card = (Card) con.newInstance(null, setInfo);
|
||||
}
|
||||
card.build();
|
||||
return card;
|
||||
} catch (Exception e) {
|
||||
|
|
@ -542,8 +558,24 @@ public abstract class CardImpl extends MageObjectImpl implements Card {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Card getSecondCardFace() {
|
||||
return this.secondSideCard;
|
||||
public final Card getSecondCardFace() {
|
||||
if (secondSideCardClazz == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (secondSideCard != null) {
|
||||
return secondSideCard;
|
||||
}
|
||||
|
||||
List<ExpansionSet.SetCardInfo> cardInfo = Sets.findSet(expansionSetCode).findCardInfoByClass(secondSideCardClazz);
|
||||
assert cardInfo.size() == 1; // should find 1 second side card
|
||||
if (cardInfo.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
ExpansionSet.SetCardInfo info = cardInfo.get(0);
|
||||
return secondSideCard = createCard(secondSideCardClazz,
|
||||
new CardSetInfo(info.getName(), expansionSetCode, info.getCardNumber(), info.getRarity(), info.getGraphicInfo()));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
35
Mage/src/main/java/mage/cards/CardSetInfo.java
Normal file
35
Mage/src/main/java/mage/cards/CardSetInfo.java
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
package mage.cards;
|
||||
|
||||
import mage.constants.Rarity;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public final class CardSetInfo implements Serializable {
|
||||
private final String name;
|
||||
private final String cardNumber;
|
||||
private final String expansionSetCode;
|
||||
private final Rarity rarity;
|
||||
private final CardGraphicInfo graphicInfo;
|
||||
|
||||
public CardSetInfo(String name, String expansionSetCode, String cardNumber, Rarity rarity) {
|
||||
this(name, expansionSetCode, cardNumber, rarity, null);
|
||||
}
|
||||
|
||||
public CardSetInfo(String name, String expansionSetCode, String cardNumber, Rarity rarity, CardGraphicInfo graphicInfo) {
|
||||
this.name = name;
|
||||
this.expansionSetCode = expansionSetCode;
|
||||
this.cardNumber = cardNumber;
|
||||
this.rarity = rarity;
|
||||
this.graphicInfo = graphicInfo;
|
||||
}
|
||||
|
||||
public String getName() { return this.name; }
|
||||
|
||||
public String getExpansionSetCode() { return this.expansionSetCode; }
|
||||
|
||||
public String getCardNumber() { return this.cardNumber; }
|
||||
|
||||
public Rarity getRarity() { return this.rarity; }
|
||||
|
||||
public CardGraphicInfo getGraphicInfo() { return this.graphicInfo; }
|
||||
}
|
||||
|
|
@ -33,6 +33,8 @@ import java.util.Date;
|
|||
import java.util.EnumMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import mage.ObjectColor;
|
||||
import mage.cards.repository.CardCriteria;
|
||||
import mage.cards.repository.CardInfo;
|
||||
import mage.cards.repository.CardRepository;
|
||||
|
|
@ -44,6 +46,49 @@ import mage.util.RandomUtil;
|
|||
* @author BetaSteward_at_googlemail.com
|
||||
*/
|
||||
public abstract class ExpansionSet implements Serializable {
|
||||
public class SetCardInfo implements Serializable {
|
||||
private final String name;
|
||||
private final String cardNumber;
|
||||
private final Rarity rarity;
|
||||
private final Class<?> cardClass;
|
||||
private final boolean usesVariousArt;
|
||||
private final CardGraphicInfo graphicInfo;
|
||||
|
||||
public SetCardInfo(String name, int cardNumber, Rarity rarity, Class<?> cardClass) {
|
||||
this(name, String.valueOf(cardNumber), rarity, cardClass, null);
|
||||
}
|
||||
|
||||
public SetCardInfo(String name, String cardNumber, Rarity rarity, Class<?> cardClass) {
|
||||
this(name, cardNumber, rarity, cardClass, null);
|
||||
}
|
||||
|
||||
public SetCardInfo(String name, int cardNumber, Rarity rarity, Class<?> cardClass, CardGraphicInfo graphicInfo) {
|
||||
this(name, String.valueOf(cardNumber), rarity, cardClass, graphicInfo);
|
||||
}
|
||||
|
||||
public SetCardInfo(String name, String cardNumber, Rarity rarity, Class<?> cardClass, CardGraphicInfo graphicInfo) {
|
||||
this.name = name;
|
||||
this.cardNumber = cardNumber;
|
||||
this.rarity = rarity;
|
||||
this.cardClass = cardClass;
|
||||
this.usesVariousArt = false;
|
||||
this.graphicInfo = graphicInfo;
|
||||
}
|
||||
|
||||
public String getName() { return this.name; }
|
||||
|
||||
public String getCardNumber() { return this.cardNumber; }
|
||||
|
||||
public Rarity getRarity() { return this.rarity; }
|
||||
|
||||
public Class<?> getCardClass() { return this.cardClass; }
|
||||
|
||||
public boolean getUsesVariousArt() { return this.usesVariousArt; }
|
||||
|
||||
public CardGraphicInfo getGraphicInfo() { return this.graphicInfo; }
|
||||
}
|
||||
|
||||
protected final List<SetCardInfo> cards = new ArrayList<>();
|
||||
|
||||
protected String name;
|
||||
protected String code;
|
||||
|
|
@ -108,11 +153,23 @@ public abstract class ExpansionSet implements Serializable {
|
|||
return blockName;
|
||||
}
|
||||
|
||||
public List<SetCardInfo> getSetCardInfo() { return cards; }
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public List<SetCardInfo> findCardInfoByClass(Class<?> clazz) {
|
||||
ArrayList<SetCardInfo> result = new ArrayList<>();
|
||||
for (SetCardInfo info : cards) {
|
||||
if (info.getCardClass().equals(clazz)) {
|
||||
result.add(info);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public List<Card> create15CardBooster() {
|
||||
// Forces 15 card booster packs.
|
||||
// if the packs are too small, it adds commons to fill it out.
|
||||
|
|
|
|||
|
|
@ -40,8 +40,8 @@ public abstract class LevelerCard extends CardImpl {
|
|||
|
||||
private int maxLevelCounters;
|
||||
|
||||
public LevelerCard(UUID ownerId, int cardNumber, String name, Rarity rarity, CardType[] cardTypes, String costs) {
|
||||
super(ownerId, cardNumber, name, rarity, cardTypes, costs);
|
||||
public LevelerCard(UUID ownerId, CardSetInfo setInfo, CardType[] cardTypes, String costs) {
|
||||
super(ownerId, setInfo, cardTypes, costs);
|
||||
}
|
||||
|
||||
public LevelerCard(LevelerCard card) {
|
||||
|
|
|
|||
|
|
@ -50,8 +50,8 @@ public abstract class MeldCard extends CardImpl {
|
|||
protected boolean isMelded;
|
||||
protected Cards halves;
|
||||
|
||||
public MeldCard(UUID ownerId, int cardNumber, String name, Rarity rarity, CardType[] cardTypes, String costs) {
|
||||
super(ownerId, cardNumber, name, rarity, cardTypes, costs);
|
||||
public MeldCard(UUID ownerId, CardSetInfo setInfo, CardType[] cardTypes, String costs) {
|
||||
super(ownerId, setInfo, cardTypes, costs);
|
||||
halves = new CardsImpl();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -27,9 +27,6 @@
|
|||
*/
|
||||
package mage.cards;
|
||||
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.PrintWriter;
|
||||
import java.util.*;
|
||||
import mage.cards.decks.DeckCardInfo;
|
||||
import mage.cards.decks.DeckCardLayout;
|
||||
import mage.cards.decks.DeckCardLists;
|
||||
|
|
@ -42,6 +39,10 @@ import mage.util.ClassScanner;
|
|||
import mage.util.RandomUtil;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.PrintWriter;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
|
|
|
|||
|
|
@ -49,14 +49,11 @@ public abstract class SplitCard extends CardImpl {
|
|||
protected Card leftHalfCard;
|
||||
protected Card rightHalfCard;
|
||||
|
||||
public SplitCard(UUID ownerId, int cardNumber, String nameLeft, String nameRight, Rarity rarity, CardType[] cardTypes, String costsLeft, String costsRight, boolean fused) {
|
||||
this(ownerId, String.valueOf(cardNumber), nameLeft, nameRight, rarity, cardTypes, costsLeft, costsRight, fused);
|
||||
}
|
||||
|
||||
public SplitCard(UUID ownerId, String cardNumber, String nameLeft, String nameRight, Rarity rarity, CardType[] cardTypes, String costsLeft, String costsRight, boolean fused) {
|
||||
super(ownerId, cardNumber, new StringBuilder(nameLeft).append(" // ").append(nameRight).toString(), rarity, cardTypes, costsLeft + costsRight, (fused ? SpellAbilityType.SPLIT_FUSED : SpellAbilityType.SPLIT));
|
||||
leftHalfCard = new SplitCardHalfImpl(this.getOwnerId(), this.getCardNumber(), nameLeft, this.rarity, cardTypes, costsLeft, this, SpellAbilityType.SPLIT_LEFT);
|
||||
rightHalfCard = new SplitCardHalfImpl(this.getOwnerId(), this.getCardNumber(), nameRight, this.rarity, cardTypes, costsRight, this, SpellAbilityType.SPLIT_RIGHT);
|
||||
public SplitCard(UUID ownerId, CardSetInfo setInfo, CardType[] cardTypes, String costsLeft, String costsRight, boolean fused) {
|
||||
super(ownerId, setInfo, cardTypes, costsLeft + costsRight, (fused ? SpellAbilityType.SPLIT_FUSED : SpellAbilityType.SPLIT));
|
||||
String[] names = setInfo.getName().split(" // ");
|
||||
leftHalfCard = new SplitCardHalfImpl(this.getOwnerId(), new CardSetInfo(names[0], setInfo.getExpansionSetCode(), setInfo.getCardNumber(), setInfo.getRarity(), setInfo.getGraphicInfo()), cardTypes, costsLeft, this, SpellAbilityType.SPLIT_LEFT);
|
||||
rightHalfCard = new SplitCardHalfImpl(this.getOwnerId(), new CardSetInfo(names[1], setInfo.getExpansionSetCode(), setInfo.getCardNumber(), setInfo.getRarity(), setInfo.getGraphicInfo()), cardTypes, costsRight, this, SpellAbilityType.SPLIT_RIGHT);
|
||||
this.splitCard = true;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -21,8 +21,8 @@ public class SplitCardHalfImpl extends CardImpl implements SplitCardHalf {
|
|||
|
||||
SplitCard splitCardParent;
|
||||
|
||||
public SplitCardHalfImpl(UUID ownerId, String cardNumber, String name, Rarity rarity, CardType[] cardTypes, String costs, SplitCard splitCardParent, SpellAbilityType spellAbilityType) {
|
||||
super(ownerId, cardNumber, name, rarity, cardTypes, costs, spellAbilityType);
|
||||
public SplitCardHalfImpl(UUID ownerId, CardSetInfo setInfo, CardType[] cardTypes, String costs, SplitCard splitCardParent, SpellAbilityType spellAbilityType) {
|
||||
super(ownerId, setInfo, cardTypes, costs, spellAbilityType);
|
||||
this.splitCardParent = splitCardParent;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -29,6 +29,8 @@
|
|||
package mage.cards.basiclands;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Rarity;
|
||||
import mage.abilities.mana.ManaAbility;
|
||||
|
|
@ -40,12 +42,8 @@ import mage.cards.CardImpl;
|
|||
*/
|
||||
public abstract class BasicLand extends CardImpl {
|
||||
|
||||
public BasicLand(UUID ownerId, int cardNumber, String name, ManaAbility mana) {
|
||||
this(ownerId, String.valueOf(cardNumber), name, mana);
|
||||
}
|
||||
|
||||
public BasicLand(UUID ownerId, String cardNumber, String name, ManaAbility mana) {
|
||||
super(ownerId, cardNumber, name, Rarity.LAND, new CardType[]{CardType.LAND}, null);
|
||||
public BasicLand(UUID ownerId, CardSetInfo setInfo, ManaAbility mana) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.LAND}, null);
|
||||
this.supertype.add("Basic");
|
||||
this.subtype.add(name);
|
||||
this.addAbility(mana);
|
||||
|
|
|
|||
|
|
@ -31,19 +31,16 @@ package mage.cards.basiclands;
|
|||
import java.util.UUID;
|
||||
import mage.ObjectColor;
|
||||
import mage.abilities.mana.GreenManaAbility;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.CardSetInfo;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
*/
|
||||
public abstract class Forest extends BasicLand {
|
||||
|
||||
public Forest(UUID ownerId, int cardNumber) {
|
||||
this(ownerId, String.valueOf(cardNumber));
|
||||
}
|
||||
|
||||
public Forest(UUID ownerId, String cardNumber) {
|
||||
super(ownerId, cardNumber, "Forest", new GreenManaAbility());
|
||||
public class Forest extends BasicLand {
|
||||
public Forest(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new GreenManaAbility());
|
||||
this.frameColor = ObjectColor.GREEN;
|
||||
}
|
||||
|
||||
|
|
@ -51,4 +48,8 @@ public abstract class Forest extends BasicLand {
|
|||
super(land);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Card copy() {
|
||||
return new Forest(this);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,19 +31,16 @@ package mage.cards.basiclands;
|
|||
import java.util.UUID;
|
||||
import mage.ObjectColor;
|
||||
import mage.abilities.mana.BlueManaAbility;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.CardSetInfo;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
*/
|
||||
public abstract class Island extends BasicLand {
|
||||
|
||||
public Island(UUID ownerId, int cardNumber) {
|
||||
this(ownerId, String.valueOf(cardNumber));
|
||||
}
|
||||
|
||||
public Island(UUID ownerId, String cardNumber) {
|
||||
super(ownerId, cardNumber, "Island", new BlueManaAbility());
|
||||
public class Island extends BasicLand {
|
||||
public Island(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new BlueManaAbility());
|
||||
this.frameColor = ObjectColor.BLUE;
|
||||
}
|
||||
|
||||
|
|
@ -51,4 +48,8 @@ public abstract class Island extends BasicLand {
|
|||
super(land);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Card copy() {
|
||||
return new Island(this);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,19 +31,16 @@ package mage.cards.basiclands;
|
|||
import java.util.UUID;
|
||||
import mage.ObjectColor;
|
||||
import mage.abilities.mana.RedManaAbility;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.CardSetInfo;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
*/
|
||||
public abstract class Mountain extends BasicLand {
|
||||
|
||||
public Mountain(UUID ownerId, int cardNumber) {
|
||||
this(ownerId, String.valueOf(cardNumber));
|
||||
}
|
||||
|
||||
public Mountain(UUID ownerId, String cardNumber) {
|
||||
super(ownerId, cardNumber, "Mountain", new RedManaAbility());
|
||||
public class Mountain extends BasicLand {
|
||||
public Mountain(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new RedManaAbility());
|
||||
this.frameColor = ObjectColor.RED;
|
||||
}
|
||||
|
||||
|
|
@ -51,4 +48,8 @@ public abstract class Mountain extends BasicLand {
|
|||
super(land);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Card copy() {
|
||||
return new Mountain(this);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,19 +31,16 @@ package mage.cards.basiclands;
|
|||
import java.util.UUID;
|
||||
import mage.ObjectColor;
|
||||
import mage.abilities.mana.WhiteManaAbility;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.CardSetInfo;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
*/
|
||||
public abstract class Plains extends BasicLand {
|
||||
|
||||
public Plains(UUID ownerId, int cardNumber) {
|
||||
this(ownerId, String.valueOf(cardNumber));
|
||||
}
|
||||
|
||||
public Plains(UUID ownerId, String cardNumber) {
|
||||
super(ownerId, cardNumber, "Plains", new WhiteManaAbility());
|
||||
public class Plains extends BasicLand {
|
||||
public Plains(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new WhiteManaAbility());
|
||||
this.frameColor = ObjectColor.WHITE;
|
||||
}
|
||||
|
||||
|
|
@ -51,4 +48,8 @@ public abstract class Plains extends BasicLand {
|
|||
super(land);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Card copy() {
|
||||
return new Plains(this);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,19 +31,16 @@ package mage.cards.basiclands;
|
|||
import java.util.UUID;
|
||||
import mage.ObjectColor;
|
||||
import mage.abilities.mana.BlackManaAbility;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.CardSetInfo;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
*/
|
||||
public abstract class Swamp extends BasicLand {
|
||||
|
||||
public Swamp(UUID ownerId, int cardNumber) {
|
||||
this(ownerId, String.valueOf(cardNumber));
|
||||
}
|
||||
|
||||
public Swamp(UUID ownerId, String cardNumber) {
|
||||
super(ownerId, cardNumber, "Swamp", new BlackManaAbility());
|
||||
public class Swamp extends BasicLand {
|
||||
public Swamp(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new BlackManaAbility());
|
||||
this.frameColor = ObjectColor.BLACK;
|
||||
}
|
||||
|
||||
|
|
@ -51,4 +48,8 @@ public abstract class Swamp extends BasicLand {
|
|||
super(land);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Card copy() {
|
||||
return new Swamp(this);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package mage.cards.mock;
|
|||
import java.util.List;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.cards.SplitCard;
|
||||
import mage.cards.repository.CardInfo;
|
||||
import mage.cards.repository.CardRepository;
|
||||
|
|
@ -15,11 +16,7 @@ import mage.constants.CardType;
|
|||
public class MockSplitCard extends SplitCard {
|
||||
|
||||
public MockSplitCard(CardInfo card) {
|
||||
super(null,
|
||||
card.getCardNumber(),
|
||||
getLeftHalfName(card),
|
||||
getRightHalfName(card),
|
||||
card.getRarity(),
|
||||
super(null, new CardSetInfo(card.getName(), card.getSetCode(), card.getCardNumber(), card.getRarity()),
|
||||
card.getTypes().toArray(new CardType[0]),
|
||||
join(card.getManaCosts()),
|
||||
"",
|
||||
|
|
@ -31,6 +28,8 @@ public class MockSplitCard extends SplitCard {
|
|||
this.subtype = card.getSubTypes();
|
||||
this.supertype = card.getSupertypes();
|
||||
|
||||
this.frameColor = card.getFrameColor();
|
||||
this.frameStyle = card.getFrameStyle();
|
||||
this.usesVariousArt = card.usesVariousArt();
|
||||
|
||||
this.color = card.getColor();
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ import java.util.Arrays;
|
|||
import java.util.List;
|
||||
|
||||
import mage.cards.FrameStyle;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Rarity;
|
||||
import mage.ObjectColor;
|
||||
|
|
@ -66,7 +67,7 @@ public class CardInfo {
|
|||
protected String cardNumber;
|
||||
@DatabaseField(indexName = "setCode_cardNumber_index")
|
||||
protected String setCode;
|
||||
@DatabaseField(unique = true, indexName = "className_index")
|
||||
@DatabaseField(indexName = "className_index")
|
||||
protected String className;
|
||||
@DatabaseField
|
||||
protected String power;
|
||||
|
|
@ -202,7 +203,7 @@ public class CardInfo {
|
|||
}
|
||||
|
||||
public Card getCard() {
|
||||
return CardImpl.createCard(className);
|
||||
return CardImpl.createCard(className, new CardSetInfo(name, setCode, cardNumber, rarity));
|
||||
}
|
||||
|
||||
public Card getMockCard() {
|
||||
|
|
|
|||
|
|
@ -45,6 +45,8 @@ import java.util.List;
|
|||
import java.util.Set;
|
||||
import java.util.TreeSet;
|
||||
import java.util.concurrent.Callable;
|
||||
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SetType;
|
||||
import mage.util.RandomUtil;
|
||||
|
|
@ -129,6 +131,23 @@ public enum CardRepository {
|
|||
return false;
|
||||
}
|
||||
|
||||
public boolean cardExists(CardSetInfo className) {
|
||||
try {
|
||||
if (classNames == null) {
|
||||
QueryBuilder<CardInfo, Object> qb = cardDao.queryBuilder();
|
||||
qb.distinct().selectColumns("className").where().isNotNull("className");
|
||||
List<CardInfo> results = cardDao.query(qb.prepare());
|
||||
classNames = new TreeSet<>();
|
||||
for (CardInfo card : results) {
|
||||
classNames.add(card.getClassName());
|
||||
}
|
||||
}
|
||||
return classNames.contains(className);
|
||||
} catch (SQLException ex) {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public Set<String> getNames() {
|
||||
Set<String> names = new TreeSet<>();
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -33,11 +33,7 @@ import java.util.HashMap;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.ExpansionSet;
|
||||
import mage.cards.Sets;
|
||||
import mage.cards.SplitCard;
|
||||
import mage.cards.*;
|
||||
import mage.util.ClassScanner;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
|
|
@ -69,10 +65,12 @@ public class CardScanner {
|
|||
}
|
||||
ExpansionRepository.instance.setContentVersion(ExpansionRepository.instance.getContentVersionConstant());
|
||||
|
||||
for (ClassLoader cl : packageMap.keySet()) {
|
||||
for (Class c : ClassScanner.findClasses(cl, packageMap.get(cl), CardImpl.class)) {
|
||||
if (!CardRepository.instance.cardExists(c.getCanonicalName())) {
|
||||
Card card = CardImpl.createCard(c);
|
||||
for (ExpansionSet set : Sets.getInstance().values()) {
|
||||
for (ExpansionSet.SetCardInfo setInfo : set.getSetCardInfo()) {
|
||||
if (CardRepository.instance.findCard(set.getCode(), setInfo.getCardNumber()) == null) {
|
||||
Card card = CardImpl.createCard(setInfo.getCardClass(),
|
||||
new CardSetInfo(setInfo.getName(), set.getCode(), setInfo.getCardNumber(),
|
||||
setInfo.getRarity(), setInfo.getGraphicInfo()));
|
||||
if (card != null) {
|
||||
cardsToAdd.add(new CardInfo(card));
|
||||
if (card instanceof SplitCard) {
|
||||
|
|
@ -84,11 +82,11 @@ public class CardScanner {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!cardsToAdd.isEmpty()) {
|
||||
logger.info("Cards need storing in DB: " + cardsToAdd.size());
|
||||
CardRepository.instance.addCards(cardsToAdd);
|
||||
}
|
||||
CardRepository.instance.setContentVersion(CardRepository.instance.getContentVersionConstant());
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@ import mage.abilities.effects.common.continuous.CommanderReplacementEffect;
|
|||
import mage.abilities.effects.common.cost.CommanderCostModification;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.cards.repository.CardInfo;
|
||||
import mage.cards.repository.CardRepository;
|
||||
import mage.constants.CardType;
|
||||
|
|
@ -164,8 +165,7 @@ public abstract class GameTinyLeadersImpl extends GameImpl {
|
|||
class DefaultCommander extends CardImpl {
|
||||
|
||||
public DefaultCommander(UUID ownerId, String commanderName, String manaString) {
|
||||
super(ownerId, 999, commanderName, Rarity.RARE, new CardType[]{CardType.CREATURE}, manaString);
|
||||
this.expansionSetCode = "";
|
||||
super(ownerId, new CardSetInfo(commanderName, "", "999", Rarity.RARE), new CardType[]{CardType.CREATURE}, manaString);
|
||||
this.supertype.add("Legendary");
|
||||
|
||||
if (manaString.contains("{G}")) {
|
||||
|
|
|
|||
|
|
@ -131,8 +131,11 @@ public class PermanentCard extends PermanentImpl {
|
|||
|
||||
transformable = card.isTransformable();
|
||||
if (transformable) {
|
||||
secondSideCard = card.getSecondCardFace();
|
||||
nightCard = card.isNightCard();
|
||||
this.nightCard = card.isNightCard();
|
||||
if (! this.nightCard) {
|
||||
this.secondSideCard = card.getSecondCardFace();
|
||||
this.secondSideCardClazz = this.secondSideCard.getClass();
|
||||
}
|
||||
}
|
||||
this.flipCard = card.isFlipCard();
|
||||
this.flipCardName = card.getFlipCardName();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue