Fix so Oracle Text appears on fallback image for copies

This commit is contained in:
drdev
2014-09-05 14:18:16 +00:00
parent 09221a180e
commit 162435ca52
5 changed files with 23 additions and 16 deletions

View File

@@ -116,7 +116,7 @@ public class AiAttackController {
}
};
for (Card c : CardLists.filter(defender.getCardsIn(ZoneType.Battlefield), canAnimate)) {
if (c.isToken() && !c.isCopiedToken()) {
if (c.isToken() && c.getCopiedPermanent() == null) {
continue;
}
for (SpellAbility sa : c.getSpellAbilities()) {

View File

@@ -152,7 +152,7 @@ public class CopyPermanentEffect extends SpellAbilityEffect {
for (int i = 0; i < multiplier; i++) {
final Card copy = CardFactory.copyCopiableCharacteristics(c, sa.getActivatingPlayer());
copy.setToken(true);
copy.setCopiedToken(true);
copy.setCopiedPermanent(c);
CardFactory.copyCopiableAbilities(c, copy);
// add keywords from sa
for (final String kw : keywords) {

View File

@@ -148,7 +148,7 @@ public class Card extends GameEntity implements Comparable<Card> {
private boolean tapped = false;
private boolean sickness = true; // summoning sickness
private boolean token = false;
private boolean copiedToken = false;
private Card copiedPermanent = null;
private boolean copiedSpell = false;
private ArrayList<Card> mustBlockCards = null;
@@ -2921,25 +2921,25 @@ public class Card extends GameEntity implements Comparable<Card> {
/**
* <p>
* Setter for the field <code>copiedToken</code>.
* Getter for the field <code>copiedPermanent</code>.
* </p>
*
* @param b
* a boolean.
* @return a Card.
*/
public final void setCopiedToken(final boolean b) {
this.copiedToken = b;
public final Card getCopiedPermanent() {
return this.copiedPermanent;
}
/**
* <p>
* isCopiedToken.
* Setter for the field <code>copiedPermanent</code>.
* </p>
*
* @return a boolean.
* @param c
* a Card.
*/
public final boolean isCopiedToken() {
return this.copiedToken;
public final void setCopiedPermanent(final Card c) {
this.copiedPermanent = c;
}
/**
@@ -8939,7 +8939,7 @@ public class Card extends GameEntity implements Comparable<Card> {
}
public int getCMC(SplitCMCMode mode) {
if (isToken() && !isCopiedToken()) {
if (isToken() && getCopiedPermanent() == null) {
return 0;
}
@@ -9157,4 +9157,12 @@ public class Card extends GameEntity implements Comparable<Card> {
public Card getCardForUi() {
return this;
}
public String getOracleText() {
CardRules rules = cardRules;
if (copiedPermanent != null) { //return oracle text of copied permanent if applicable
rules = copiedPermanent.getRules();
}
return rules != null ? rules.getOracleText() : "";
}
} // end Card class

View File

@@ -73,7 +73,7 @@ public class CardFactory {
*/
public final static Card copyCard(final Card in, boolean assignNewId) {
Card out;
if (!(in.isToken() || in.isCopiedToken())) {
if (!(in.isToken() || in.getCopiedPermanent() != null)) {
out = assignNewId ? getCard(in.getPaperCard(), in.getOwner())
: getCard(in.getPaperCard(), in.getOwner(), in.getUniqueNumber());
} else { // token

View File

@@ -255,8 +255,7 @@ public class CardImageRenderer {
g.drawImage(image, x + (w - iconSize) / 2, y + (h - iconSize) / 2, iconSize, iconSize);
}
else {
if (card.getRules() == null) { return; } //this can happen with certain tokens
String text = card.getRules().getOracleText();
String text = card.getOracleText();
if (StringUtils.isEmpty(text)) { return; }
text = text.replace("\\n", "\n"); //replace new line placeholders with actual new line characters