Closed shithead closed 2 years ago
can you show me a screencap of the error ? You mean mountain from differents sets are are not merged ?
ok i see
Hi I want to help in this issue.
My Idea to do it is to create an extra MagicDeck var in class DrawProbabilityPanel, which hold unique cardnames without edition information and merged counter.
Do you think that's a good strategy?
We should update DrawProbabilityPanel.initDeck() function, and build a "dynamic" model with correct cards count... i'm working on it ;)
okay i work on some code like this.
public class MagicDeck implements MTGStorable {
public MagicDeck getMergedDeck() {
// found double named cards
// get count of cards
// int getCardCountByName(cardName);
// set new Deck without edition information
List<MagicCard> mergeCardList = new ArrayList<MagicCard>();
List<String> cardNames = new ArrayList<String>();
getMainAsList().forEach(mc -> {
if (! cardNames.contains(mc.getName())) {
getMainAsList().stream().filter(k->k.getName().equalsIgnoreCase(mc.getName())).forEach(k->mergeCardList.add(mc));
cardNames.add(mc.getName());
}
});
MagicDeck mergedDeck = toDeck(mergeCardList);
mergedDeck.setName("merged cards deck");
return mergedDeck;
}
but i get an outofbound. sorry im not good in java.
so this code get the right cards back, but i still get a java.lang.ArrayIndexOutOfBoundsException
now its work, here my diff draw_probability.diff.txt
merge cards with same name to one probability.
E.g. Mountains from different editions can merge his draw probabilities.