mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 04:38:00 +00:00
Card: add RenderForUI to disable Render for Effects (#6792)
This commit is contained in:
@@ -338,7 +338,7 @@ public final class GameActionUtil {
|
||||
newSA.setMayPlay(o);
|
||||
|
||||
final StringBuilder sb = new StringBuilder(sa.getDescription());
|
||||
if (!source.equals(host) && host.getCardForUi() != null) {
|
||||
if (!source.equals(host) && host.getRenderForUI()) {
|
||||
sb.append(" by ");
|
||||
if (host.isImmutable() && host.getEffectSource() != null) {
|
||||
sb.append(host.getEffectSource());
|
||||
|
||||
@@ -14,6 +14,7 @@ public class DetachedCardEffect extends Card {
|
||||
super(card0.getOwner().getGame().nextCardId(), card0.getPaperCard(), card0.getOwner().getGame());
|
||||
card = card0;
|
||||
|
||||
this.renderForUi = false;
|
||||
setName(name0);
|
||||
setOwner(card0.getOwner());
|
||||
setGamePieceType(GamePieceType.EFFECT);
|
||||
@@ -24,6 +25,7 @@ public class DetachedCardEffect extends Card {
|
||||
public DetachedCardEffect(Player owner, String name) {
|
||||
super(owner.getGame().nextCardId(), null, owner.getGame());
|
||||
this.card = null;
|
||||
this.renderForUi = false;
|
||||
|
||||
this.setName(name);
|
||||
this.setOwner(owner);
|
||||
@@ -36,6 +38,7 @@ public class DetachedCardEffect extends Card {
|
||||
|
||||
public DetachedCardEffect(DetachedCardEffect from, Game game, boolean assignNewId) {
|
||||
super(assignNewId ? game.nextCardId() : from.id, from.getPaperCard(), game);
|
||||
this.renderForUi = from.renderForUi;
|
||||
this.setName(from.getName());
|
||||
this.setGamePieceType(GamePieceType.EFFECT);
|
||||
if(from.getGame() == game) {
|
||||
|
||||
@@ -337,6 +337,7 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars, ITr
|
||||
private CombatLki combatLKI;
|
||||
|
||||
private CardRules cardRules;
|
||||
protected boolean renderForUi = true;
|
||||
private final CardView view;
|
||||
|
||||
private SpellAbility[] basicLandAbilities = new SpellAbility[MagicColor.WUBRG.length];
|
||||
@@ -6452,16 +6453,20 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars, ITr
|
||||
}
|
||||
|
||||
public final String getImageKey() {
|
||||
if (!getRenderForUI()) {
|
||||
return "";
|
||||
}
|
||||
Card uiCard = getCardForUi();
|
||||
if(uiCard == null)
|
||||
return "";
|
||||
return uiCard.currentState.getImageKey();
|
||||
}
|
||||
public final void setImageKey(final String iFN) {
|
||||
if (!getRenderForUI()) {
|
||||
return;
|
||||
}
|
||||
Card uiCard = getCardForUi();
|
||||
if(uiCard == null)
|
||||
this.currentState.setImageKey(iFN); //Shouldn't really matter; the card isn't supposed to show in the UI anyway.
|
||||
else
|
||||
if(uiCard != null)
|
||||
uiCard.currentState.setImageKey(iFN);
|
||||
}
|
||||
public final void setImageKey(final IPaperCard ipc, final CardStateName stateName) {
|
||||
@@ -6489,6 +6494,9 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars, ITr
|
||||
}
|
||||
|
||||
public String getImageKey(CardStateName state) {
|
||||
if (!getRenderForUI()) {
|
||||
return "";
|
||||
}
|
||||
Card uiCard = getCardForUi();
|
||||
if(uiCard == null)
|
||||
return "";
|
||||
@@ -7617,6 +7625,14 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars, ITr
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean getRenderForUI() {
|
||||
return this.renderForUi;
|
||||
}
|
||||
|
||||
public void setRenderForUI(boolean value) {
|
||||
renderForUi = value;
|
||||
}
|
||||
|
||||
public IPaperCard getPaperCard() {
|
||||
IPaperCard cp = paperCard;
|
||||
if (cp != null) {
|
||||
|
||||
@@ -65,7 +65,7 @@ public class CardView extends GameEntityView {
|
||||
}
|
||||
TrackableCollection<CardView> collection = new TrackableCollection<>();
|
||||
for (Card c : cards) {
|
||||
if (c.getCardForUi() == c) { //only add cards that match their card for UI
|
||||
if (c.getRenderForUI()) { //only add cards that match their card for UI
|
||||
collection.add(c.getView());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -318,7 +318,7 @@ public class ReplacementHandler {
|
||||
replacementEffect.getParam("OptionalDecider"), effectSA).get(0);
|
||||
}
|
||||
|
||||
String name = CardTranslation.getTranslatedName(MoreObjects.firstNonNull(host.getCardForUi(), host).getName());
|
||||
String name = CardTranslation.getTranslatedName(MoreObjects.firstNonNull(host.getRenderForUI() ? host.getCardForUi() : null, host).getName());
|
||||
String effectDesc = TextUtil.fastReplace(replacementEffect.getDescription(), "CARDNAME", name);
|
||||
final String question = runParams.containsKey(AbilityKey.Card)
|
||||
? Localizer.getInstance().getMessage("lblApplyCardReplacementEffectToCardConfirm", name, runParams.get(AbilityKey.Card).toString(), effectDesc)
|
||||
|
||||
Reference in New Issue
Block a user