mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-16 18:58:00 +00:00
Merge pull request #3097 from kevlahnota/newmaster2
update Specialize ImageKey
This commit is contained in:
@@ -5879,6 +5879,29 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars {
|
|||||||
public final void setImageKey(final String iFN) {
|
public final void setImageKey(final String iFN) {
|
||||||
getCardForUi().currentState.setImageKey(iFN);
|
getCardForUi().currentState.setImageKey(iFN);
|
||||||
}
|
}
|
||||||
|
public final void setImageKey(final IPaperCard ipc, final CardStateName stateName) {
|
||||||
|
if (ipc == null)
|
||||||
|
return;
|
||||||
|
switch (stateName) {
|
||||||
|
case SpecializeB:
|
||||||
|
setImageKey(ipc.getCardBSpecImageKey());
|
||||||
|
break;
|
||||||
|
case SpecializeR:
|
||||||
|
setImageKey(ipc.getCardRSpecImageKey());
|
||||||
|
break;
|
||||||
|
case SpecializeG:
|
||||||
|
setImageKey(ipc.getCardGSpecImageKey());
|
||||||
|
break;
|
||||||
|
case SpecializeU:
|
||||||
|
setImageKey(ipc.getCardUSpecImageKey());
|
||||||
|
break;
|
||||||
|
case SpecializeW:
|
||||||
|
setImageKey(ipc.getCardWSpecImageKey());
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public String getImageKey(CardStateName state) {
|
public String getImageKey(CardStateName state) {
|
||||||
CardState c = getCardForUi().states.get(state);
|
CardState c = getCardForUi().states.get(state);
|
||||||
@@ -6003,6 +6026,7 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars {
|
|||||||
}
|
}
|
||||||
public final void setSpecialized(final boolean bool) {
|
public final void setSpecialized(final boolean bool) {
|
||||||
specialized = bool;
|
specialized = bool;
|
||||||
|
setImageKey(getPaperCard(), getCurrentStateName());
|
||||||
}
|
}
|
||||||
public final boolean canSpecialize() {
|
public final boolean canSpecialize() {
|
||||||
return getRules() != null && getRules().getSplitType() == CardSplitType.Specialize;
|
return getRules() != null && getRules().getSplitType() == CardSplitType.Specialize;
|
||||||
|
|||||||
@@ -253,6 +253,13 @@ public class CardView extends GameEntityView {
|
|||||||
set(TrackableProperty.IsBoon, c.isBoon());
|
set(TrackableProperty.IsBoon, c.isBoon());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean canSpecialize() {
|
||||||
|
return get(TrackableProperty.CanSpecialize);
|
||||||
|
}
|
||||||
|
public void updateSpecialize(Card c) {
|
||||||
|
set(TrackableProperty.CanSpecialize, c.canSpecialize());
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isTokenCard() { return get(TrackableProperty.TokenCard); }
|
public boolean isTokenCard() { return get(TrackableProperty.TokenCard); }
|
||||||
void updateTokenCard(Card c) { set(TrackableProperty.TokenCard, c.isTokenCard()); }
|
void updateTokenCard(Card c) { set(TrackableProperty.TokenCard, c.isTokenCard()); }
|
||||||
|
|
||||||
@@ -917,6 +924,7 @@ public class CardView extends GameEntityView {
|
|||||||
updateName(c);
|
updateName(c);
|
||||||
updateZoneText(c);
|
updateZoneText(c);
|
||||||
updateDamage(c);
|
updateDamage(c);
|
||||||
|
updateSpecialize(c);
|
||||||
|
|
||||||
if (c.getIntensity(false) > 0) {
|
if (c.getIntensity(false) > 0) {
|
||||||
updateIntensity(c);
|
updateIntensity(c);
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ public enum TrackableProperty {
|
|||||||
IsImmutable(TrackableTypes.BooleanType),
|
IsImmutable(TrackableTypes.BooleanType),
|
||||||
IsEmblem(TrackableTypes.BooleanType),
|
IsEmblem(TrackableTypes.BooleanType),
|
||||||
IsBoon(TrackableTypes.BooleanType),
|
IsBoon(TrackableTypes.BooleanType),
|
||||||
|
CanSpecialize(TrackableTypes.BooleanType),
|
||||||
|
|
||||||
Flipped(TrackableTypes.BooleanType),
|
Flipped(TrackableTypes.BooleanType),
|
||||||
Facedown(TrackableTypes.BooleanType),
|
Facedown(TrackableTypes.BooleanType),
|
||||||
|
|||||||
@@ -11,23 +11,28 @@ import com.badlogic.gdx.utils.Align;
|
|||||||
|
|
||||||
import forge.Forge;
|
import forge.Forge;
|
||||||
import forge.Graphics;
|
import forge.Graphics;
|
||||||
|
import forge.assets.FSkinFont;
|
||||||
import forge.assets.FSkinImage;
|
import forge.assets.FSkinImage;
|
||||||
import forge.deck.ArchetypeDeckGenerator;
|
import forge.deck.ArchetypeDeckGenerator;
|
||||||
import forge.deck.CardThemedDeckGenerator;
|
import forge.deck.CardThemedDeckGenerator;
|
||||||
import forge.deck.CommanderDeckGenerator;
|
import forge.deck.CommanderDeckGenerator;
|
||||||
import forge.deck.DeckProxy;
|
import forge.deck.DeckProxy;
|
||||||
import forge.game.GameView;
|
import forge.game.GameView;
|
||||||
|
import forge.game.card.Card;
|
||||||
import forge.game.card.CardView;
|
import forge.game.card.CardView;
|
||||||
import forge.gamemodes.planarconquest.ConquestCommander;
|
import forge.gamemodes.planarconquest.ConquestCommander;
|
||||||
import forge.item.IPaperCard;
|
import forge.item.IPaperCard;
|
||||||
import forge.item.InventoryItem;
|
import forge.item.InventoryItem;
|
||||||
|
import forge.item.PaperCard;
|
||||||
import forge.localinstance.properties.ForgePreferences;
|
import forge.localinstance.properties.ForgePreferences;
|
||||||
import forge.localinstance.properties.ForgePreferences.FPref;
|
import forge.localinstance.properties.ForgePreferences.FPref;
|
||||||
import forge.model.FModel;
|
import forge.model.FModel;
|
||||||
import forge.screens.match.MatchController;
|
import forge.screens.match.MatchController;
|
||||||
import forge.toolbox.FCardPanel;
|
import forge.toolbox.FCardPanel;
|
||||||
import forge.toolbox.FDialog;
|
import forge.toolbox.FDialog;
|
||||||
|
import forge.toolbox.FLabel;
|
||||||
import forge.toolbox.FOverlay;
|
import forge.toolbox.FOverlay;
|
||||||
|
import forge.util.ImageUtil;
|
||||||
import forge.util.Utils;
|
import forge.util.Utils;
|
||||||
import forge.util.collect.FCollectionView;
|
import forge.util.collect.FCollectionView;
|
||||||
|
|
||||||
@@ -46,6 +51,7 @@ public class CardZoom extends FOverlay {
|
|||||||
private static String currentActivateAction;
|
private static String currentActivateAction;
|
||||||
private static Rectangle flipIconBounds;
|
private static Rectangle flipIconBounds;
|
||||||
private static Rectangle mutateIconBounds;
|
private static Rectangle mutateIconBounds;
|
||||||
|
private static FLabel specialize;
|
||||||
private static boolean showAltState;
|
private static boolean showAltState;
|
||||||
private static boolean showBackSide = false;
|
private static boolean showBackSide = false;
|
||||||
private static boolean showMerged = false;
|
private static boolean showMerged = false;
|
||||||
@@ -90,6 +96,41 @@ public class CardZoom extends FOverlay {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private CardZoom() {
|
private CardZoom() {
|
||||||
|
specialize = add(new FLabel.ButtonBuilder().text(Forge.getLocalizer().getMessage("lblSpecialized")).font(FSkinFont.get(12)).selectable().command(e -> {
|
||||||
|
if (currentCard != null) {
|
||||||
|
final List<CardView> list = new ArrayList<>();
|
||||||
|
final PaperCard pc = ImageUtil.getPaperCardFromImageKey(currentCard.getCurrentState().getTrackableImageKey());
|
||||||
|
if (pc != null) {
|
||||||
|
Card cardW = Card.fromPaperCard(pc, null);
|
||||||
|
cardW.setState(CardStateName.SpecializeW, true);
|
||||||
|
cardW.setImageKey(pc, CardStateName.SpecializeW);
|
||||||
|
list.add(cardW.getView());
|
||||||
|
|
||||||
|
Card cardU = Card.fromPaperCard(pc, null);
|
||||||
|
cardU.setState(CardStateName.SpecializeU, true);
|
||||||
|
cardU.setImageKey(pc, CardStateName.SpecializeU);
|
||||||
|
list.add(cardU.getView());
|
||||||
|
|
||||||
|
Card cardB = Card.fromPaperCard(pc, null);
|
||||||
|
cardB.setState(CardStateName.SpecializeB, true);
|
||||||
|
cardB.setImageKey(pc, CardStateName.SpecializeB);
|
||||||
|
list.add(cardB.getView());
|
||||||
|
|
||||||
|
Card cardR = Card.fromPaperCard(pc, null);
|
||||||
|
cardR.setState(CardStateName.SpecializeR, true);
|
||||||
|
cardR.setImageKey(pc, CardStateName.SpecializeR);
|
||||||
|
list.add(cardR.getView());
|
||||||
|
|
||||||
|
Card cardG = Card.fromPaperCard(pc, null);
|
||||||
|
cardG.setState(CardStateName.SpecializeG, true);
|
||||||
|
cardG.setImageKey(pc, CardStateName.SpecializeG);
|
||||||
|
list.add(cardG.getView());
|
||||||
|
}
|
||||||
|
if (!list.isEmpty())
|
||||||
|
show(list, 0, null);
|
||||||
|
}
|
||||||
|
}).buildAboveOverlay());
|
||||||
|
specialize.setVisible(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -144,6 +185,10 @@ public class CardZoom extends FOverlay {
|
|||||||
mutateIconBounds = new Rectangle();
|
mutateIconBounds = new Rectangle();
|
||||||
}
|
}
|
||||||
showAltState = false;
|
showAltState = false;
|
||||||
|
if (currentCard != null && currentCard.canSpecialize() && currentCard.getCurrentState().getState() == CardStateName.Original)
|
||||||
|
specialize.setVisible(true);
|
||||||
|
else
|
||||||
|
specialize.setVisible(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static CardView getCardView(Object item) {
|
private static CardView getCardView(Object item) {
|
||||||
@@ -362,6 +407,9 @@ public class CardZoom extends FOverlay {
|
|||||||
g.fillRect(FDialog.getMsgBackColor(), 0, h - messageHeight, w, messageHeight);
|
g.fillRect(FDialog.getMsgBackColor(), 0, h - messageHeight, w, messageHeight);
|
||||||
g.drawText(zoomMode ? Forge.getLocalizer().getMessage("lblSwipeDownDetailView") : Forge.getLocalizer().getMessage("lblSwipeDownPictureView"), FDialog.MSG_FONT, FDialog.getMsgForeColor(), 0, h - messageHeight, w, messageHeight, false, Align.center, true);
|
g.drawText(zoomMode ? Forge.getLocalizer().getMessage("lblSwipeDownDetailView") : Forge.getLocalizer().getMessage("lblSwipeDownPictureView"), FDialog.MSG_FONT, FDialog.getMsgForeColor(), 0, h - messageHeight, w, messageHeight, false, Align.center, true);
|
||||||
|
|
||||||
|
if (specialize.isVisible()) {
|
||||||
|
specialize.setBounds(w/2 - specialize.getAutoSizeBounds().width/2, h - specialize.getAutoSizeBounds().height - messageHeight, specialize.getAutoSizeBounds().width, specialize.getAutoSizeBounds().height);
|
||||||
|
}
|
||||||
interrupt(false);
|
interrupt(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -47,6 +47,13 @@ public class FLabel extends FDisplayObject implements IButton {
|
|||||||
|
|
||||||
public FLabel build() { return new FLabel(this); }
|
public FLabel build() { return new FLabel(this); }
|
||||||
|
|
||||||
|
public FLabel buildAboveOverlay() { return new FLabel(this) {
|
||||||
|
@Override
|
||||||
|
protected boolean drawAboveOverlay() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}; }
|
||||||
|
|
||||||
// Begin builder methods.
|
// Begin builder methods.
|
||||||
public Builder text(final String s0) { this.bldText = s0; return this; }
|
public Builder text(final String s0) { this.bldText = s0; return this; }
|
||||||
public Builder icon(final FImage i0) { this.bldIcon = i0; return this; }
|
public Builder icon(final FImage i0) { this.bldIcon = i0; return this; }
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ Oracle:Flying\nWhenever you attack with one or more other creatures with flying,
|
|||||||
SPECIALIZE:BLUE
|
SPECIALIZE:BLUE
|
||||||
|
|
||||||
Name:Lulu, Curious Hollyphant
|
Name:Lulu, Curious Hollyphant
|
||||||
ManaCost:2 W W
|
ManaCost:2 W U
|
||||||
Types:Legendary Creature Elephant Angel
|
Types:Legendary Creature Elephant Angel
|
||||||
PT:2/4
|
PT:2/4
|
||||||
K:Flying
|
K:Flying
|
||||||
|
|||||||
Reference in New Issue
Block a user