forked from External/mage
[TDM] Implement omen mechanic (#13501)
* Abstract AdventureCard to SingleFaceSplitCard * Fix AdventureCardSpellImpl * Finish converting adventure card and adventure spell * Update Brightcap Badger change finalize call to adventure card * Update Darksteel Monolith being cast from hand condition referencing AdventureCardSpell * Update Tlincalli Hunter exiled creature condition referencing AdventureCardSpell * Update Twice Upon a Time finalizeAdventure called from Adventure card * Finish abstracting Adventure missed some more references to adventure cards * Implement Omen cards * Implement Dirgur Island Dragon * Missed some adventureSpellName references * OmenCardSpell had wrong comma symbol * Add tests for Omen Cards * Rename two part card components change from SingleFaceSplitCard to CardWithSpellOption * Update comments and variable name
This commit is contained in:
parent
e3937e31c1
commit
0df5f17603
36 changed files with 637 additions and 264 deletions
|
|
@ -123,6 +123,7 @@ public class ModernCardRenderer extends CardRenderer {
|
|||
public static final Color ERROR_COLOR = new Color(255, 0, 255);
|
||||
|
||||
static String SUB_TYPE_ADVENTURE = "Adventure";
|
||||
static String SUB_TYPE_OMEN = "Omen";
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// Layout metrics for modern border cards
|
||||
|
|
@ -168,8 +169,8 @@ public class ModernCardRenderer extends CardRenderer {
|
|||
// Processed mana cost string
|
||||
protected String manaCostString;
|
||||
|
||||
// Is an adventure
|
||||
protected boolean isAdventure = false;
|
||||
// Is an adventure or omen
|
||||
protected boolean isCardWithSpellOption = false;
|
||||
|
||||
public ModernCardRenderer(CardView card) {
|
||||
// Pass off to parent
|
||||
|
|
@ -179,12 +180,13 @@ public class ModernCardRenderer extends CardRenderer {
|
|||
manaCostString = ManaSymbols.getClearManaCost(cardView.getManaCostStr());
|
||||
|
||||
if (cardView.isSplitCard()) {
|
||||
isAdventure = cardView.getRightSplitTypeLine().contains(SUB_TYPE_ADVENTURE);
|
||||
isCardWithSpellOption = cardView.getRightSplitTypeLine().contains(SUB_TYPE_ADVENTURE)
|
||||
|| cardView.getRightSplitTypeLine().contains(SUB_TYPE_OMEN);
|
||||
}
|
||||
}
|
||||
|
||||
protected boolean isAdventure() {
|
||||
return isAdventure;
|
||||
protected boolean isCardWithSpellOption() {
|
||||
return isCardWithSpellOption;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -660,7 +662,7 @@ public class ModernCardRenderer extends CardRenderer {
|
|||
drawRulesText(g, textboxKeywords, textboxRules,
|
||||
contentWidth / 2 + totalContentInset + 4, totalContentInset + boxHeight + 2,
|
||||
contentWidth / 2 - 8, typeLineY - totalContentInset - boxHeight - 6, false);
|
||||
} else if (isAdventure) {
|
||||
} else if (isCardWithSpellOption) {
|
||||
drawRulesText(g, textboxKeywords, textboxRules,
|
||||
contentWidth / 2 + totalContentInset + 4, typeLineY + boxHeight + 2,
|
||||
contentWidth / 2 - 8, cardHeight - typeLineY - boxHeight - 4 - borderWidth * 3, false);
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ public class ModernSplitCardRenderer extends ModernCardRenderer {
|
|||
private boolean isAftermath = false;
|
||||
|
||||
private static String trimAdventure(String rule) {
|
||||
if (rule.startsWith("Adventure")) {
|
||||
if (rule.startsWith("Adventure") || rule.startsWith("Omen")) {
|
||||
return rule.substring(rule.lastIndexOf("—") + 8);
|
||||
}
|
||||
return rule;
|
||||
|
|
@ -71,7 +71,7 @@ public class ModernSplitCardRenderer extends ModernCardRenderer {
|
|||
rightHalf.color = new ObjectColor(cardView.getRightSplitCostsStr());
|
||||
leftHalf.color = new ObjectColor(cardView.getLeftSplitCostsStr());
|
||||
|
||||
if (isAdventure()) {
|
||||
if (isCardWithSpellOption()) {
|
||||
List<String> trimmedRules = new ArrayList<>();
|
||||
for (String rule : view.getRightSplitRules()) {
|
||||
trimmedRules.add(trimAdventure(rule));
|
||||
|
|
@ -95,7 +95,7 @@ public class ModernSplitCardRenderer extends ModernCardRenderer {
|
|||
// they "rotate" in opposite directions making consquence and normal split cards
|
||||
// have the "right" vs "left" as the top half.
|
||||
// Adventures are treated differently and not rotated at all.
|
||||
if (isAdventure()) {
|
||||
if (isCardWithSpellOption()) {
|
||||
manaCostString = leftHalf.manaCostString;
|
||||
textboxKeywords = leftHalf.keywords;
|
||||
textboxRules = leftHalf.rules;
|
||||
|
|
@ -159,7 +159,7 @@ public class ModernSplitCardRenderer extends ModernCardRenderer {
|
|||
protected void drawBackground(Graphics2D g) {
|
||||
if (cardView.isFaceDown()) {
|
||||
drawCardBackTexture(g);
|
||||
} if (isAdventure()) {
|
||||
} if (isCardWithSpellOption()) {
|
||||
super.drawBackground(g);
|
||||
} else {
|
||||
{ // Left half background (top of the card)
|
||||
|
|
@ -204,7 +204,7 @@ public class ModernSplitCardRenderer extends ModernCardRenderer {
|
|||
|
||||
@Override
|
||||
protected void drawArt(Graphics2D g) {
|
||||
if (isAdventure) {
|
||||
if (isCardWithSpellOption) {
|
||||
super.drawArt(g);
|
||||
} else if (artImage != null) {
|
||||
if (isAftermath()) {
|
||||
|
|
@ -318,7 +318,7 @@ public class ModernSplitCardRenderer extends ModernCardRenderer {
|
|||
|
||||
@Override
|
||||
protected void drawFrame(Graphics2D g, CardPanelAttributes attribs, BufferedImage image, boolean lessOpaqueRulesTextBox) {
|
||||
if (isAdventure()) {
|
||||
if (isCardWithSpellOption()) {
|
||||
super.drawFrame(g, attribs, image, lessOpaqueRulesTextBox);
|
||||
|
||||
CardPanelAttributes adventureAttribs = new CardPanelAttributes(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue