* UI: multiple improves for adventure/split cards:

* Split cards shows left and right mana cost (in deck editor, hand, etc);
 * Adventure cards shows adventure and normal cost (in deck editor, hand, etc);
 * Adventure cards shows adventure spell name in deck editor's list;
 * Fixed missing loading cursor in deck editor searching;
This commit is contained in:
Oleg Agafonov 2020-01-07 11:49:55 +04:00
parent c4ad761ebb
commit 339c419d4b
18 changed files with 311 additions and 102 deletions

View file

@ -2,6 +2,8 @@ package mage.cards.mock;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.costs.mana.ManaCost;
import mage.abilities.costs.mana.ManaCosts;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.cards.CardImpl;
import mage.cards.repository.CardInfo;
@ -11,15 +13,24 @@ import org.apache.log4j.Logger;
import java.util.List;
/**
* Mock card for GUI (deck editor and panels)
*
* @author North
*/
public class MockCard extends CardImpl {
static public String ADVENTURE_NAME_SEPARATOR = " // ";
// Needs to be here, as it is normally calculated from the
// PlaneswalkerEntersWithLoyaltyAbility of the card... but the MockCard
// only has MockAbilities.
private int startingLoyalty;
// mana cost extra info for multiple mana drawing
protected ManaCosts<ManaCost> manaCostLeft;
protected ManaCosts<ManaCost> manaCostRight;
protected String adventureSpellName;
public MockCard(CardInfo card) {
super(null, card.getName());
this.cardNumber = card.getCardNumber();
@ -33,7 +44,9 @@ public class MockCard extends CardImpl {
this.usesVariousArt = card.usesVariousArt();
this.manaCost = new ManaCostsImpl(join(card.getManaCosts()));
this.manaCostLeft = new ManaCostsImpl(join(card.getManaCosts(CardInfo.ManaCostSide.LEFT)));
this.manaCostRight = new ManaCostsImpl(join(card.getManaCosts(CardInfo.ManaCostSide.RIGHT)));
this.manaCost = new ManaCostsImpl(join(card.getManaCosts(CardInfo.ManaCostSide.ALL)));
this.color = card.getColor();
@ -49,6 +62,10 @@ public class MockCard extends CardImpl {
this.secondSideCard = new MockCard(CardRepository.instance.findCardWPreferredSet(card.getSecondSideName(), card.getSetCode(), false));
}
if (card.isAdventureCard()) {
this.adventureSpellName = card.getAdventureSpellName();
}
if (this.isPlaneswalker()) {
String startingLoyaltyString = card.getStartingLoyalty();
if (startingLoyaltyString.isEmpty()) {
@ -82,6 +99,32 @@ public class MockCard extends CardImpl {
return new MockCard(this);
}
@Override
public ManaCosts<ManaCost> getManaCost() {
return manaCost;
}
public ManaCosts<ManaCost> getManaCost(CardInfo.ManaCostSide manaCostSide) {
switch (manaCostSide) {
case LEFT:
return manaCostLeft;
case RIGHT:
return manaCostRight;
default:
case ALL:
return manaCost;
}
}
public String getFullName(boolean showSecondName) {
if (adventureSpellName != null) {
return getName() + ADVENTURE_NAME_SEPARATOR + adventureSpellName;
} else {
return getName();
}
}
private MageInt mageIntFromString(String value) {
try {
int intValue = Integer.parseInt(value);