Skip to content

Commit

Permalink
Merge branch 'master' into kaya-spirits-justice
Browse files Browse the repository at this point in the history
  • Loading branch information
xenohedron authored Feb 22, 2024
2 parents c21fb63 + 4ce2e7d commit 48ba592
Show file tree
Hide file tree
Showing 1,037 changed files with 9,958 additions and 4,929 deletions.
23 changes: 23 additions & 0 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
dev:
- changed-files:
- any-glob-to-any-file: [ '*', 'Utils/**', '/.github/**' ]

engine:
- changed-files:
- any-glob-to-any-file: [ 'Mage/**' ]

client:
- changed-files:
- any-glob-to-any-file: [ 'Mage.Client/**', 'Mage.Common/**', 'Mage.Plugins/**' ]

server:
- changed-files:
- any-glob-to-any-file: [ 'Mage.Server*/**' ]

tests:
- changed-files:
- any-glob-to-any-file: [ 'Mage.Verify/**', 'Mage.Tests/**', 'Mage.Reports/**' ]

cards:
- changed-files:
- any-glob-to-any-file: [ 'Mage.Sets/**' ]
15 changes: 15 additions & 0 deletions .github/workflows/labeler-auto.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: "Pull Request Labeler (auto)"
on:
- pull_request_target

jobs:
labeler:
permissions:
contents: read
pull-requests: write
runs-on: ubuntu-latest
steps:
- id: label-the-PR
uses: actions/labeler@v5
with:
configuration-path: '.github/labeler.yml'
24 changes: 24 additions & 0 deletions .github/workflows/labeler-manual.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: "Pull Request Labeler (manual)"
on:
workflow_dispatch:
inputs:
oldPRs:
# no multi lines support, so call by single PR only
description: 'PR number to process'
required: true
type: string
default: '123'

jobs:
labeler:
permissions:
contents: read
pull-requests: write
runs-on: ubuntu-latest
steps:
- id: label-the-PR
uses: actions/labeler@v5
with:
configuration-path: '.github/labeler.yml'
pr-number: |
${{ github.event.inputs.oldPRs }}
4 changes: 2 additions & 2 deletions Mage.Client/src/main/java/mage/client/cards/DragCardGrid.java
Original file line number Diff line number Diff line change
Expand Up @@ -1705,7 +1705,7 @@ public void blingDeck() {
java.util.List<CardInfo> cardPool = CardRepository.instance.findCards(cardCriteria);

if (!cardPool.isEmpty()) {
Card acard = cardPool.get(RandomUtil.nextInt(cardPool.size())).getMockCard();
Card acard = cardPool.get(RandomUtil.nextInt(cardPool.size())).createMockCard();

if (acard.getName().equals(card.getName())) {
CardView pimpedCard = new CardView(acard);
Expand Down Expand Up @@ -1751,7 +1751,7 @@ private void oldVersionDeck() {
for (CardView card : stack) {
CardInfo oldestCardInfo = CardRepository.instance.findOldestNonPromoVersionCard(card.getName());
if (oldestCardInfo != null) {
CardView oldestCardView = new CardView(oldestCardInfo.getMockCard());
CardView oldestCardView = new CardView(oldestCardInfo.createMockCard());
this.removeCardView(card);
eventSource.fireEvent(card, ClientEventType.DECK_REMOVE_SPECIFIC_CARD);
this.addCardView(oldestCardView, false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public void init(String cardName, BigCard bigCard, UUID gameId) {
return;
}

this.init(new CardView(cardInfo.getCard()), bigCard, gameId);
this.init(new CardView(cardInfo.createCard()), bigCard, gameId);
}

public void init(CardView cardView, BigCard bigCard, UUID gameId) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ private void addHyperlinkHandlers() {
if (cardView == null) {
CardInfo card = CardRepository.instance.findCards(cardName).stream().findFirst().orElse(null);
if (card != null) {
cardView = new CardView(card.getMockCard());
cardView = new CardView(card.createMockCard());
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,13 @@
import mage.cards.decks.Deck;
import mage.cards.repository.CardCriteria;
import mage.cards.repository.CardInfo;
import mage.cards.repository.CardRepository;
import mage.cards.repository.ExpansionRepository;
import mage.client.dialog.PreferencesDialog;
import mage.client.util.sets.ConstructedFormats;
import mage.constants.CardType;
import mage.constants.ColoredManaSymbol;
import mage.constants.Rarity;
import mage.constants.SuperType;
import mage.util.RandomUtil;
import mage.util.TournamentUtil;

import java.util.*;

Expand Down Expand Up @@ -230,6 +227,6 @@ static void addBasicLands(int landsNeeded, Map<String, Double> percentage, Map<S
private static Card getBasicLand(ColoredManaSymbol color, Map<String, List<CardInfo>> basicLands) {
String landName = DeckGeneratorPool.getBasicLandName(color.toString());
List<CardInfo> basicLandsInfo = basicLands.get(landName);
return basicLandsInfo.get(RandomUtil.nextInt(basicLandsInfo.size())).getMockCard().copy();
return basicLandsInfo.get(RandomUtil.nextInt(basicLandsInfo.size())).createMockCard().copy();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ public Map<String,Integer> countManaProduced(List<Card> deckLands)
public List<Card> filterLands(List<CardInfo> landCardsInfo) {
List<Card> matchingLandList = new ArrayList<>();
for(CardInfo landCardInfo: landCardsInfo) {
Card landCard = landCardInfo.getMockCard();
Card landCard = landCardInfo.createMockCard();
if(landProducesChosenColors(landCard)) {
matchingLandList.add(landCard);
}
Expand Down Expand Up @@ -556,7 +556,7 @@ protected static void generateSpells(CardCriteria criteria, int spellCount) {
if (retrievedCount > 0 && retrievedCount >= spellCount) {
int tries = 0;
while (count < spellCount) {
Card card = cardPool.get(RandomUtil.nextInt(retrievedCount)).getMockCard();
Card card = cardPool.get(RandomUtil.nextInt(retrievedCount)).createMockCard();
if (genPool.isValidSpellCard(card)) {
int cardCMC = card.getManaValue();
for (DeckGeneratorCMC.CMC deckCMC : deckCMCs) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,7 @@ private void filterCards() {
}
}
// filter by settings
Card card = cardInfo.getMockCard();
Card card = cardInfo.createMockCard();
if (!filter.match(card, null)) {
continue;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ private Card retrieveTemporaryCard(SimpleCardView cardView) {
if (card == null) {
// Need to make a new card
Logger.getLogger(DeckEditorPanel.class).info("Retrieve " + cardView.getCardNumber() + " Failed");
card = CardRepository.instance.findCard(cardView.getExpansionSetCode(), cardView.getCardNumber()).getCard();
card = CardRepository.instance.findCard(cardView.getExpansionSetCode(), cardView.getCardNumber()).createCard();
} else {
// Only need a temporary card once
temporaryCards.remove(cardView.getId());
Expand Down Expand Up @@ -578,7 +578,7 @@ private void setCardNumberToCardsList(Event event, Set<Card> cards) {
// add cards
CardInfo cardInfo = CardRepository.instance.findCard(cardView.getExpansionSetCode(), cardView.getCardNumber());
for (int i = cardsFound; i < numberToSet; i++) {
cards.add(cardInfo.getMockCard());
cards.add(cardInfo.createMockCard());
}
} else {
// remove cards
Expand All @@ -605,7 +605,7 @@ private void moveSelectorCardToDeck(Event event) {
} else {
// editor: create mock card
CardInfo cardInfo = CardRepository.instance.findCard(cardView.getExpansionSetCode(), cardView.getCardNumber());
card = cardInfo != null ? cardInfo.getMockCard() : null;
card = cardInfo != null ? cardInfo.createMockCard() : null;
}

if (card != null) {
Expand Down Expand Up @@ -633,7 +633,7 @@ private void moveSelectorCardToSideboard(Event event) {

SimpleCardView cardView = (SimpleCardView) event.getSource();
CardInfo cardInfo = CardRepository.instance.findCard(cardView.getExpansionSetCode(), cardView.getCardNumber());
Card card = cardInfo != null ? cardInfo.getMockCard() : null;
Card card = cardInfo != null ? cardInfo.createMockCard() : null;
if (card != null) {
deck.getSideboard().add(card);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,7 @@ private List<Object> loadCards() {
List<CardInfo> cards = CardRepository.instance.findCards(criteria);
cards.sort(new NaturalOrderCardNumberComparator());
List<Object> res = new ArrayList<>();
cards.forEach(card -> res.add(new CardView(card.getMockCard())));
cards.forEach(card -> res.add(new CardView(card.createMockCard())));
return res;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ private void addLands(String landName, int number, boolean useFullArt) {
int foundLands = 0;
int foundNoneAfter = 0;
for (int i = 0; foundLands != number && foundNoneAfter < 1000; i++) {
Card land = cards.get(RandomUtil.nextInt(cards.size())).getMockCard();
Card land = cards.get(RandomUtil.nextInt(cards.size())).createMockCard();
boolean useLand = !useFullArt;
if (useFullArt && (land.getFrameStyle() == FrameStyle.BFZ_FULL_ART_BASIC
|| land.getFrameStyle() == FrameStyle.UGL_FULL_ART_BASIC
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -408,9 +408,35 @@ private void reloadCardsAndPlayer() {

/* test split, transform and mdf in hands
cardViews.add(createHandCard(game, playerYou.getId(), "SOI", "97")); // Accursed Witch
cardViews.add(createHandCard(game, playerYou.getId(), "ZNR", "134")); // Akoum Warrior
cardViews.add(createHandCard(game, playerYou.getId(), "UMA", "225")); // Fire // Ice
cardViews.add(createHandCard(game, playerYou.getId(), "DGM", "123")); // Beck // Call
cardViews.add(createHandCard(game, playerYou.getId(), "AKH", "210")); // Dusk // Dawn
//*/

//* test adventure cards in hands
cardViews.add(createHandCard(game, playerYou.getId(), "ELD", "14")); // Giant Killer
cardViews.add(createHandCard(game, playerYou.getId(), "ZNR", "134")); // Akoum Warrior
cardViews.add(createHandCard(game, playerYou.getId(), "WOE", "222")); // Cruel Somnophage
cardViews.add(createHandCard(game, playerYou.getId(), "WOE", "227")); // Gingerbread Hunter
cardViews.add(createHandCard(game, playerYou.getId(), "WOE", "221")); // Callous Sell-Sword
cardViews.add(createHandCard(game, playerYou.getId(), "ELD", "149")); // Beanstalk Giant
cardViews.add(createHandCard(game, playerYou.getId(), "WOE", "220")); // Beluna Grandsquall
//*/

/* test saga and case cards in hands
cardViews.add(createHandCard(game, playerYou.getId(), "DOM", "90")); // The Eldest Reborn
cardViews.add(createHandCard(game, playerYou.getId(), "MH2", "259")); // Urza's Saga
cardViews.add(createHandCard(game, playerYou.getId(), "MKM", "113")); // Case of the Burning Masks
cardViews.add(createHandCard(game, playerYou.getId(), "MKM", "155")); // Case of the Locked Hothouse
//*/

//* test case, class and saga cards in hands
cardViews.add(createHandCard(game, playerYou.getId(), "MKM", "113")); // Case of the Burning Masks
cardViews.add(createHandCard(game, playerYou.getId(), "MKM", "155")); // Case of the Locked Hothouse
cardViews.add(createHandCard(game, playerYou.getId(), "AFR", "6")); // Cleric Class
cardViews.add(createHandCard(game, playerYou.getId(), "AFR", "230")); // Rogue Class
cardViews.add(createHandCard(game, playerYou.getId(), "DOM", "90")); // The Eldest Reborn
cardViews.add(createHandCard(game, playerYou.getId(), "MH2", "259")); // Urza's Saga
//*/

/* test meld cards in hands and battlefield
Expand Down Expand Up @@ -441,7 +467,7 @@ private void reloadCardsAndPlayer() {
//cardViews.add(createPermanentCard(game, playerYou.getId(), "KHM", "50", 1, 1, 0, true, false, additionalIcons)); // Cosima, God of the Voyage
//*/

//* test tokens
/* test tokens
// normal
cardViews.add(createToken(game, playerYou.getId(), new ZombieToken(), "10E", 0, false, false));
cardViews.add(createToken(game, playerYou.getId(), new ZombieToken(), "XXX", 1, false, false));
Expand Down Expand Up @@ -826,7 +852,7 @@ private void comboRenderModeItemStateChanged(java.awt.event.ItemEvent evt) {//GE
}//GEN-LAST:event_comboRenderModeItemStateChanged

private void sliderSizeStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_sliderSizeStateChanged
// from DragCardGrid
// from DragCardGrid
// Fraction in [-1, 1]
float sliderFrac = ((float) (sliderSize.getValue() - 50)) / 50;
// Convert to frac in [0.5, 2.0] exponentially
Expand Down
4 changes: 2 additions & 2 deletions Mage.Client/src/main/java/mage/client/util/CardsViewUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public static CardsView convertSimple(SimpleCardsView view) {

for (SimpleCardView simple : view.values()) {
CardInfo cardInfo = CardRepository.instance.findCard(simple.getExpansionSetCode(), simple.getCardNumber());
Card card = cardInfo != null ? cardInfo.getMockCard() : null;
Card card = cardInfo != null ? cardInfo.createMockCard() : null;
if (card != null) {
cards.put(simple.getId(), new CardView(card, simple));
}
Expand All @@ -35,7 +35,7 @@ public static CardsView convertSimple(SimpleCardsView view, Map<String, Card> lo
Card card = loadedCards.get(key);
if (card == null) {
CardInfo cardInfo = CardRepository.instance.findCard(simple.getExpansionSetCode(), simple.getCardNumber());
card = cardInfo != null ? cardInfo.getMockCard() : null;
card = cardInfo != null ? cardInfo.createMockCard() : null;
loadedCards.put(key, card);
}
if (card != null) {
Expand Down
4 changes: 2 additions & 2 deletions Mage.Client/src/main/java/mage/client/util/DeckUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public static Deck construct(DeckView view) {
deck.setName(view.getName());
for (SimpleCardView cardView : view.getCards().values()) {
CardInfo cardInfo = CardRepository.instance.findCard(cardView.getExpansionSetCode(), cardView.getCardNumber());
Card card = cardInfo != null ? cardInfo.getMockCard() : null;
Card card = cardInfo != null ? cardInfo.createMockCard() : null;
if (card != null) {
deck.getCards().add(card);
} else {
Expand All @@ -36,7 +36,7 @@ public static Deck construct(DeckView view) {
}
for (SimpleCardView cardView : view.getSideboard().values()) {
CardInfo cardInfo = CardRepository.instance.findCard(cardView.getExpansionSetCode(), cardView.getCardNumber());
Card card = cardInfo != null ? cardInfo.getMockCard() : null;
Card card = cardInfo != null ? cardInfo.createMockCard() : null;
if (card != null) {
deck.getSideboard().add(card);
} else {
Expand Down
11 changes: 11 additions & 0 deletions Mage.Client/src/main/java/mage/client/util/gui/GuiDisplayUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@
import mage.view.CardView;
import mage.view.CounterView;
import mage.view.PermanentView;
import net.java.truevfs.access.TFile;
import org.jdesktop.swingx.JXPanel;
import org.mage.card.arcane.ManaSymbols;
import org.mage.card.arcane.UI;
import org.mage.plugins.card.utils.CardImageUtils;

import javax.swing.*;
import java.awt.*;
Expand Down Expand Up @@ -402,6 +404,15 @@ else if (prefs.fontFamily == CardFontFamily.verdana) {
buffer.append("<p style='margin: 2px'><b>Card Zone:</b> ").append(zone).append("</p>");
}

// missing image info in card popup
boolean displayFullImagePath = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_SHOW_FULL_IMAGE_PATH, "false").equals("true");
if (displayFullImagePath) {
String imageFile = CardImageUtils.buildImagePathToCardView(card);
if (imageFile.startsWith("ERROR") || !(new TFile(imageFile).exists())) {
buffer.append("<p style='margin: 2px'><b>Missing image:</b> ").append(imageFile).append("</p>");
}
}

buffer.append("<br></body></html>");
return buffer;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,8 @@ public abstract class CardRenderer {
protected int borderWidth;

// The parsed text of the card
protected final ArrayList<TextboxRule> textboxRules = new ArrayList<>();
protected final ArrayList<TextboxRule> textboxKeywords = new ArrayList<>();
protected ArrayList<TextboxRule> textboxRules = new ArrayList<>();
protected ArrayList<TextboxRule> textboxKeywords = new ArrayList<>();

// The Construtor
// The constructor should prepare all of the things that it can
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package org.mage.card.arcane;

import mage.cards.ArtRect;
import mage.view.CardView;

/**
Expand All @@ -12,9 +11,7 @@ public CardRendererFactory() {
}

public CardRenderer create(CardView card) {
if (card.isSplitCard() && card.getArtRect() != ArtRect.SPLIT_FUSED) {
// Split fused cards still render with the normal frame, showing all abilities
// from both halves in one frame.
if (card.isSplitCard()) {
return new ModernSplitCardRenderer(card);
} else {
return new ModernCardRenderer(card);
Expand Down
Loading

0 comments on commit 48ba592

Please sign in to comment.