mirror of
https://github.com/correl/mage.git
synced 2025-01-13 03:00:10 +00:00
added MockCard (for display only)
This commit is contained in:
parent
462992e838
commit
e9b81dd006
1 changed files with 81 additions and 0 deletions
81
Mage/src/mage/cards/MockCard.java
Normal file
81
Mage/src/mage/cards/MockCard.java
Normal file
|
@ -0,0 +1,81 @@
|
|||
package mage.cards;
|
||||
|
||||
import com.sun.deploy.util.StringUtils;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.AbilityImpl;
|
||||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||
import mage.cards.repository.CardInfo;
|
||||
import mage.cards.repository.CardRepository;
|
||||
import mage.constants.AbilityType;
|
||||
import mage.constants.Zone;
|
||||
import mage.watchers.Watcher;
|
||||
|
||||
/**
|
||||
* @author North
|
||||
*/
|
||||
public class MockCard extends CardImpl {
|
||||
public MockCard(CardInfo card) {
|
||||
super(null, card.getName());
|
||||
this.cardNumber = card.getCardNumber();
|
||||
this.expansionSetCode = card.getSetCode();
|
||||
this.power = mageIntFromString(card.getPower());
|
||||
this.toughness = mageIntFromString(card.getToughness());
|
||||
this.rarity = card.getRarity();
|
||||
this.cardType = card.getTypes();
|
||||
this.subtype = card.getSubTypes();
|
||||
this.supertype = card.getSupertypes();
|
||||
|
||||
this.manaCost = new ManaCostsImpl(StringUtils.join(card.getManaCosts(), ""));
|
||||
|
||||
this.color = card.getColor();
|
||||
this.splitCard = card.isSplitCard();
|
||||
this.flipCard = card.isFlipCard();
|
||||
|
||||
this.canTransform = card.isDoubleFaced();
|
||||
this.nightCard = card.isNightCard();
|
||||
if (card.getSecondSideName() != null && !card.getSecondSideName().isEmpty()) {
|
||||
this.secondSideCard = new MockCard(CardRepository.instance.findCard(card.getSecondSideName()));
|
||||
}
|
||||
|
||||
this.flipCardName = card.getFlipCardName();
|
||||
|
||||
for(String text: card.getRules()) {
|
||||
this.addAbility(textAbilityFromString(text));
|
||||
}
|
||||
}
|
||||
|
||||
public MockCard(final MockCard card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public MockCard copy() {
|
||||
return new MockCard(this);
|
||||
}
|
||||
|
||||
private MageInt mageIntFromString(String value) {
|
||||
try {
|
||||
int intValue = Integer.parseInt(value);
|
||||
return new MageInt(intValue);
|
||||
} catch (NumberFormatException e) {
|
||||
return new MageInt(0, value);
|
||||
}
|
||||
}
|
||||
|
||||
private Ability textAbilityFromString(final String text) {
|
||||
return new AbilityImpl(AbilityType.STATIC, Zone.ALL) {
|
||||
@Override
|
||||
public AbilityImpl copy() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRule(boolean all) {
|
||||
return text;
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue