* Some minor code clean up.

This commit is contained in:
LevelX2 2020-06-16 10:42:53 +02:00
parent 146c9571ca
commit ff3a51cc22
2 changed files with 15 additions and 21 deletions

View file

@ -317,13 +317,6 @@ public class CardView extends SimpleCardView {
} }
} }
AdventureCard adventureCard = null;
AdventureCardSpell adventureCardSpell = null;
if (card instanceof AdventureCard) {
adventureCard = (AdventureCard) card;
adventureCardSpell = (AdventureCardSpell) adventureCard.getSpellCard();
}
String fullCardName; String fullCardName;
if (splitCard != null) { if (splitCard != null) {
this.isSplitCard = true; this.isSplitCard = true;
@ -339,7 +332,9 @@ public class CardView extends SimpleCardView {
fullCardName = card.getName(); // split card contains full name as normal fullCardName = card.getName(); // split card contains full name as normal
this.manaCostLeft = splitCard.getLeftHalfCard().getManaCost().getSymbols(); this.manaCostLeft = splitCard.getLeftHalfCard().getManaCost().getSymbols();
this.manaCostRight = splitCard.getRightHalfCard().getManaCost().getSymbols(); this.manaCostRight = splitCard.getRightHalfCard().getManaCost().getSymbols();
} else if (adventureCard != null) { } else if (card instanceof AdventureCard) {
AdventureCard adventureCard = ((AdventureCard) card);
AdventureCardSpell adventureCardSpell = ((AdventureCardSpell) adventureCard.getSpellCard());
fullCardName = adventureCard.getName() + MockCard.ADVENTURE_NAME_SEPARATOR + adventureCardSpell.getName(); fullCardName = adventureCard.getName() + MockCard.ADVENTURE_NAME_SEPARATOR + adventureCardSpell.getName();
this.manaCostLeft = adventureCardSpell.getManaCost().getSymbols(); this.manaCostLeft = adventureCardSpell.getManaCost().getSymbols();
this.manaCostRight = adventureCard.getManaCost().getSymbols(); this.manaCostRight = adventureCard.getManaCost().getSymbols();
@ -466,7 +461,7 @@ public class CardView extends SimpleCardView {
} else if (spell.getCard() != null) { } else if (spell.getCard() != null) {
SplitCard wholeCard = ((SplitCardHalf) spell.getCard()).getParentCard(); SplitCard wholeCard = ((SplitCardHalf) spell.getCard()).getParentCard();
Abilities<Ability> aftermathHalfAbilities = wholeCard.getRightHalfCard().getAbilities(game); Abilities<Ability> aftermathHalfAbilities = wholeCard.getRightHalfCard().getAbilities(game);
if (aftermathHalfAbilities.stream().anyMatch(ability -> ability instanceof AftermathAbility)) { if (aftermathHalfAbilities.stream().anyMatch(halfAbility -> halfAbility instanceof AftermathAbility)) {
if (ty == SpellAbilityType.SPLIT_RIGHT) { if (ty == SpellAbilityType.SPLIT_RIGHT) {
artRect = ArtRect.AFTERMATH_BOTTOM; artRect = ArtRect.AFTERMATH_BOTTOM;
} else { } else {
@ -1029,26 +1024,25 @@ public class CardView extends SimpleCardView {
} }
public String getColorText() { public String getColorText() {
String colorText = getColor().getDescription();
String color = getColor().getDescription(); return colorText.substring(0, 1).toUpperCase(Locale.ENGLISH) + colorText.substring(1);
return color.substring(0, 1).toUpperCase(Locale.ENGLISH) + color.substring(1);
} }
public String getTypeText() { public String getTypeText() {
StringBuilder type = new StringBuilder(); StringBuilder typeText = new StringBuilder();
if (!getSuperTypes().isEmpty()) { if (!getSuperTypes().isEmpty()) {
type.append(String.join(" ", getSuperTypes().stream().map(SuperType::toString).collect(Collectors.toList()))); typeText.append(String.join(" ", getSuperTypes().stream().map(SuperType::toString).collect(Collectors.toList())));
type.append(" "); typeText.append(" ");
} }
if (!getCardTypes().isEmpty()) { if (!getCardTypes().isEmpty()) {
type.append(String.join(" ", getCardTypes().stream().map(CardType::toString).collect(Collectors.toList()))); typeText.append(String.join(" ", getCardTypes().stream().map(CardType::toString).collect(Collectors.toList())));
type.append(" "); typeText.append(" ");
} }
if (!getSubTypes().isEmpty()) { if (!getSubTypes().isEmpty()) {
type.append(" - "); typeText.append(" - ");
type.append(String.join(" ", getSubTypes().stream().map(SubType::toString).collect(Collectors.toList()))); typeText.append(String.join(" ", getSubTypes().stream().map(SubType::toString).collect(Collectors.toList())));
} }
return type.toString(); return typeText.toString();
} }
public boolean isLand() { public boolean isLand() {

View file

@ -41,7 +41,7 @@ class EssenceBacklashEffect extends OneShotEffect {
public EssenceBacklashEffect() { public EssenceBacklashEffect() {
super(Outcome.Damage); super(Outcome.Damage);
staticText = "Counter target creature spell. Essence Backlash deals damage equal to that spell's power to its controller"; staticText = "Counter target creature spell. {this} deals damage equal to that spell's power to its controller";
} }
public EssenceBacklashEffect(final EssenceBacklashEffect effect) { public EssenceBacklashEffect(final EssenceBacklashEffect effect) {