mirror of
https://github.com/correl/mage.git
synced 2025-03-24 01:02:43 -09:00
GUI: fixed card's defense stat drawing in deck editor
This commit is contained in:
parent
3226b85589
commit
bc5c381fef
3 changed files with 26 additions and 10 deletions
Mage/src/main/java/mage
|
@ -8,6 +8,7 @@ import mage.cards.CardImpl;
|
|||
import mage.cards.ModalDoubleFacesCard;
|
||||
import mage.cards.repository.CardInfo;
|
||||
import mage.cards.repository.CardRepository;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
@ -26,6 +27,7 @@ public class MockCard extends CardImpl {
|
|||
// PlaneswalkerEntersWithLoyaltyAbility of the card... but the MockCard
|
||||
// only has MockAbilities.
|
||||
private final int startingLoyalty;
|
||||
private final int startingDefense;
|
||||
|
||||
// mana cost extra info for multiple mana drawing
|
||||
// warning, don't use ManaCost objects here due too much memory consumptions
|
||||
|
@ -79,16 +81,9 @@ public class MockCard extends CardImpl {
|
|||
this.isModalDoubleFacesCard = true;
|
||||
}
|
||||
|
||||
switch (card.getStartingLoyalty()) {
|
||||
case "X":
|
||||
this.startingLoyalty = -2;
|
||||
break;
|
||||
case "":
|
||||
this.startingLoyalty = -1;
|
||||
break;
|
||||
default:
|
||||
this.startingLoyalty = Integer.parseInt(card.getStartingLoyalty());
|
||||
}
|
||||
this.startingLoyalty = CardUtil.convertLoyaltyOrDefense(card.getStartingLoyalty());
|
||||
this.startingDefense = CardUtil.convertLoyaltyOrDefense(card.getStartingDefense());
|
||||
|
||||
this.flipCardName = card.getFlipCardName();
|
||||
for (String ruleText : card.getRules()) {
|
||||
this.addAbility(textAbilityFromString(ruleText));
|
||||
|
@ -99,6 +94,7 @@ public class MockCard extends CardImpl {
|
|||
super(card);
|
||||
|
||||
this.startingLoyalty = card.startingLoyalty;
|
||||
this.startingDefense = card.startingDefense;
|
||||
this.manaCostLeftStr = new ArrayList<>(card.manaCostLeftStr);
|
||||
this.manaCostRightStr = new ArrayList<>(card.manaCostRightStr);
|
||||
this.manaCostStr = new ArrayList<>(card.manaCostStr);
|
||||
|
@ -112,6 +108,11 @@ public class MockCard extends CardImpl {
|
|||
return startingLoyalty;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getStartingDefense() {
|
||||
return startingDefense;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MockCard copy() {
|
||||
return new MockCard(this);
|
||||
|
|
|
@ -390,6 +390,10 @@ public class CardInfo {
|
|||
return startingLoyalty;
|
||||
}
|
||||
|
||||
public String getStartingDefense() {
|
||||
return startingDefense;
|
||||
}
|
||||
|
||||
public String getSetCode() {
|
||||
return setCode;
|
||||
}
|
||||
|
|
|
@ -1737,6 +1737,17 @@ public final class CardUtil {
|
|||
}
|
||||
}
|
||||
|
||||
public static int convertLoyaltyOrDefense(String value) {
|
||||
switch (value) {
|
||||
case "X":
|
||||
return -2;
|
||||
case "":
|
||||
return -1;
|
||||
default:
|
||||
return Integer.parseInt(value);
|
||||
}
|
||||
}
|
||||
|
||||
public static void checkSetParamForSerializationCompatibility(Set<String> data) {
|
||||
// HashMap uses inner class for Keys without serialization support,
|
||||
// so you can't use it for client-server data
|
||||
|
|
Loading…
Add table
Reference in a new issue