* GUI: added card icon for announced X value (card cast);

This commit is contained in:
Oleg Agafonov 2021-07-19 13:40:21 +04:00
parent fc0ff6c22d
commit 76082e1d7a
9 changed files with 353 additions and 12 deletions

View file

@ -7,10 +7,12 @@ import mage.abilities.Abilities;
import mage.abilities.Ability;
import mage.abilities.Mode;
import mage.abilities.SpellAbility;
import mage.abilities.dynamicvalue.common.ManacostVariableValue;
import mage.abilities.effects.Effect;
import mage.abilities.effects.Effects;
import mage.abilities.icon.CardIcon;
import mage.abilities.icon.other.FaceDownStatusIcon;
import mage.abilities.icon.other.FaceDownCardIcon;
import mage.abilities.icon.other.VariableCostCardIcon;
import mage.abilities.keyword.AftermathAbility;
import mage.cards.*;
import mage.cards.mock.MockCard;
@ -369,7 +371,7 @@ public class CardView extends SimpleCardView {
this.manaCostRightStr = String.join("", mainCard.getRightHalfCard().getManaCostSymbols());
} else if (card instanceof AdventureCard) {
AdventureCard adventureCard = ((AdventureCard) card);
AdventureCardSpell adventureCardSpell = ((AdventureCardSpell) adventureCard.getSpellCard());
AdventureCardSpell adventureCardSpell = adventureCard.getSpellCard();
fullCardName = adventureCard.getName() + MockCard.ADVENTURE_NAME_SEPARATOR + adventureCardSpell.getName();
this.manaCostLeftStr = String.join("", adventureCardSpell.getManaCostSymbols());
this.manaCostRightStr = String.join("", adventureCard.getManaCostSymbols());
@ -420,11 +422,10 @@ public class CardView extends SimpleCardView {
permanent.getAbilities(game).forEach(ability -> {
this.cardIcons.addAll(ability.getIcons(game));
});
// other
// face down
if (permanent.isFaceDown(game)) {
this.cardIcons.add(FaceDownStatusIcon.instance);
this.cardIcons.add(FaceDownCardIcon.instance);
}
} else {
if (card.isCopy()) {
this.mageObjectType = MageObjectType.COPY_CARD;
@ -439,6 +440,25 @@ public class CardView extends SimpleCardView {
}
}
}
// card icons for any permanents and cards
if (game != null) {
// x cost
Zone cardZone = game.getState().getZone(card.getId());
if (card.getManaCost().containsX()
&& (cardZone.match(Zone.BATTLEFIELD) || cardZone.match(Zone.STACK))) {
int costX;
if (card instanceof Permanent) {
// permanent on battlefield
costX = ManacostVariableValue.ETB.calculate(game, card.getSpellAbility(), null);
} else {
// other like Stack
costX = ManacostVariableValue.REGULAR.calculate(game, card.getSpellAbility(), null);
}
this.cardIcons.add(new VariableCostCardIcon(costX));
}
}
this.power = Integer.toString(card.getPower().getValue());
this.toughness = Integer.toString(card.getToughness().getValue());
this.cardTypes = card.getCardType(game);