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);
|
newSA.setMayPlay(o);
|
||||||
|
|
||||||
final StringBuilder sb = new StringBuilder(sa.getDescription());
|
final StringBuilder sb = new StringBuilder(sa.getDescription());
|
||||||
if (!source.equals(host) && host.getCardForUi() != null) {
|
if (!source.equals(host) && host.getRenderForUI()) {
|
||||||
sb.append(" by ");
|
sb.append(" by ");
|
||||||
if (host.isImmutable() && host.getEffectSource() != null) {
|
if (host.isImmutable() && host.getEffectSource() != null) {
|
||||||
sb.append(host.getEffectSource());
|
sb.append(host.getEffectSource());
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ public class DetachedCardEffect extends Card {
|
|||||||
super(card0.getOwner().getGame().nextCardId(), card0.getPaperCard(), card0.getOwner().getGame());
|
super(card0.getOwner().getGame().nextCardId(), card0.getPaperCard(), card0.getOwner().getGame());
|
||||||
card = card0;
|
card = card0;
|
||||||
|
|
||||||
|
this.renderForUi = false;
|
||||||
setName(name0);
|
setName(name0);
|
||||||
setOwner(card0.getOwner());
|
setOwner(card0.getOwner());
|
||||||
setGamePieceType(GamePieceType.EFFECT);
|
setGamePieceType(GamePieceType.EFFECT);
|
||||||
@@ -24,6 +25,7 @@ public class DetachedCardEffect extends Card {
|
|||||||
public DetachedCardEffect(Player owner, String name) {
|
public DetachedCardEffect(Player owner, String name) {
|
||||||
super(owner.getGame().nextCardId(), null, owner.getGame());
|
super(owner.getGame().nextCardId(), null, owner.getGame());
|
||||||
this.card = null;
|
this.card = null;
|
||||||
|
this.renderForUi = false;
|
||||||
|
|
||||||
this.setName(name);
|
this.setName(name);
|
||||||
this.setOwner(owner);
|
this.setOwner(owner);
|
||||||
@@ -36,6 +38,7 @@ public class DetachedCardEffect extends Card {
|
|||||||
|
|
||||||
public DetachedCardEffect(DetachedCardEffect from, Game game, boolean assignNewId) {
|
public DetachedCardEffect(DetachedCardEffect from, Game game, boolean assignNewId) {
|
||||||
super(assignNewId ? game.nextCardId() : from.id, from.getPaperCard(), game);
|
super(assignNewId ? game.nextCardId() : from.id, from.getPaperCard(), game);
|
||||||
|
this.renderForUi = from.renderForUi;
|
||||||
this.setName(from.getName());
|
this.setName(from.getName());
|
||||||
this.setGamePieceType(GamePieceType.EFFECT);
|
this.setGamePieceType(GamePieceType.EFFECT);
|
||||||
if(from.getGame() == game) {
|
if(from.getGame() == game) {
|
||||||
|
|||||||
@@ -337,6 +337,7 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars, ITr
|
|||||||
private CombatLki combatLKI;
|
private CombatLki combatLKI;
|
||||||
|
|
||||||
private CardRules cardRules;
|
private CardRules cardRules;
|
||||||
|
protected boolean renderForUi = true;
|
||||||
private final CardView view;
|
private final CardView view;
|
||||||
|
|
||||||
private SpellAbility[] basicLandAbilities = new SpellAbility[MagicColor.WUBRG.length];
|
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() {
|
public final String getImageKey() {
|
||||||
|
if (!getRenderForUI()) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
Card uiCard = getCardForUi();
|
Card uiCard = getCardForUi();
|
||||||
if(uiCard == null)
|
if(uiCard == null)
|
||||||
return "";
|
return "";
|
||||||
return uiCard.currentState.getImageKey();
|
return uiCard.currentState.getImageKey();
|
||||||
}
|
}
|
||||||
public final void setImageKey(final String iFN) {
|
public final void setImageKey(final String iFN) {
|
||||||
|
if (!getRenderForUI()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
Card uiCard = getCardForUi();
|
Card uiCard = getCardForUi();
|
||||||
if(uiCard == null)
|
if(uiCard != null)
|
||||||
this.currentState.setImageKey(iFN); //Shouldn't really matter; the card isn't supposed to show in the UI anyway.
|
|
||||||
else
|
|
||||||
uiCard.currentState.setImageKey(iFN);
|
uiCard.currentState.setImageKey(iFN);
|
||||||
}
|
}
|
||||||
public final void setImageKey(final IPaperCard ipc, final CardStateName stateName) {
|
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) {
|
public String getImageKey(CardStateName state) {
|
||||||
|
if (!getRenderForUI()) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
Card uiCard = getCardForUi();
|
Card uiCard = getCardForUi();
|
||||||
if(uiCard == null)
|
if(uiCard == null)
|
||||||
return "";
|
return "";
|
||||||
@@ -7617,6 +7625,14 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars, ITr
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean getRenderForUI() {
|
||||||
|
return this.renderForUi;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRenderForUI(boolean value) {
|
||||||
|
renderForUi = value;
|
||||||
|
}
|
||||||
|
|
||||||
public IPaperCard getPaperCard() {
|
public IPaperCard getPaperCard() {
|
||||||
IPaperCard cp = paperCard;
|
IPaperCard cp = paperCard;
|
||||||
if (cp != null) {
|
if (cp != null) {
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ public class CardView extends GameEntityView {
|
|||||||
}
|
}
|
||||||
TrackableCollection<CardView> collection = new TrackableCollection<>();
|
TrackableCollection<CardView> collection = new TrackableCollection<>();
|
||||||
for (Card c : cards) {
|
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());
|
collection.add(c.getView());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -318,7 +318,7 @@ public class ReplacementHandler {
|
|||||||
replacementEffect.getParam("OptionalDecider"), effectSA).get(0);
|
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);
|
String effectDesc = TextUtil.fastReplace(replacementEffect.getDescription(), "CARDNAME", name);
|
||||||
final String question = runParams.containsKey(AbilityKey.Card)
|
final String question = runParams.containsKey(AbilityKey.Card)
|
||||||
? Localizer.getInstance().getMessage("lblApplyCardReplacementEffectToCardConfirm", name, runParams.get(AbilityKey.Card).toString(), effectDesc)
|
? Localizer.getInstance().getMessage("lblApplyCardReplacementEffectToCardConfirm", name, runParams.get(AbilityKey.Card).toString(), effectDesc)
|
||||||
|
|||||||
Reference in New Issue
Block a user