It is currently 28 Apr 2024, 07:43
   
Text Size

Forge version 1.5.13

Post MTG Forge Related Programming Questions Here

Moderators: timmermac, Blacksmith, KrazyTheFox, Agetian, friarsol, CCGHQ Admins

Forge version 1.5.13

Postby Chris H. » 07 Feb 2014, 18:21

Tentative target release date: Friday February 21 2014.
User avatar
Chris H.
Forge Moderator
 
Posts: 6320
Joined: 04 Nov 2008, 12:11
Location: Mac OS X Yosemite
Has thanked: 644 times
Been thanked: 643 times

Re: Forge version 1.5.13

Postby drdev » 08 Feb 2014, 04:54

I've added a "Expand/Collapse all groups" button to make it easier to work with groups. I also tweaked how image resizing is done such that now, instead of supporting fixed sizes between 50 and 300, it supports showing between 1 and 10 columns. Ctrl+MouseWheel still works as before, plus I've added a combo box to select the value.

The result looks like this:

ViewDeckOptions.png

The nice thing about this is it no longer ends up with wasted space between the final card in a row and the scrollbar, plus it plays nicer with the wrapping such that if you want to see all 8 piles in a group in single row, it's easy to do.

Let me know what you think.

Thanks.
-Dan
drdev
Programmer
 
Posts: 1958
Joined: 27 Jul 2013, 02:07
Has thanked: 189 times
Been thanked: 565 times

Re: Forge version 1.5.13

Postby Agetian » 08 Feb 2014, 13:13

I'm back to my long-going project that has to do with implementing foil support. I would like to consult with you all here because the next phase of implementing foil support is going to be, on the one hand, critically important, on the other hand, there are several issues that need to be worked out:

1) I have come up with a mockup implementation of the generation of foils in booster packs. However, the code feels somewhat clunky, I believe I may not fully realize how the entire print sheet-generation may work in order to implement foil support more optimally. If any of you have suggestions about how to implement it better, please let me know. Here's what I currently have (I'm not committing to SVN yet, for the reason outlined above and for the reasons below):

This is for BoosterGenerator.java (BoosterGenerator in forge.card):
Code: Select all
    private static final String getFoilSlot(SealedProduct.Template booster) {
        String setCode = booster.getEdition() != null ? booster.getEdition() : null;
        CardEdition set = setCode != null ? StaticData.instance().getEditions().getEditionByCodeOrThrow(setCode) : null;

        if (set == null || set.getFoilType() == FoilType.NOT_SUPPORTED) {
            return null;
        }

        if (MyRandom.getRandom().nextInt(100) <= StaticData.instance().getEditions().getEditionByCodeOrThrow(setCode).getFoilChanceInBooster()) {
            if (set.getFoilAlwaysInCommonSlot()) {
                return BoosterSlots.COMMON;
            }
            else {
                return Aggregates.random(booster.getSlots()).getKey();
            }
        }

        return null; // null == no foil is generated
    }
   
    private static final PaperCard generateFoilCard(SealedProduct.Template booster) {
        String setCode = booster.getEdition() != null ? booster.getEdition() : null;
        String sheetKey = StaticData.instance().getEditions().contains(setCode) ? BoosterSlots.ANY + " " + setCode : BoosterSlots.ANY;

        PrintSheet ps = getPrintSheet(sheetKey);

        return StaticData.instance().getCommonCards().getFoiled(ps.random(1, true).get(0));
    }
   
    public static final List<PaperCard> getBoosterPack(SealedProduct.Template booster) {
        List<PaperCard> result = new ArrayList<PaperCard>();
        String foilSlot = getFoilSlot(booster);

        for(Pair<String, Integer> slot : booster.getSlots()) {
            String slotType = slot.getLeft(); // add expansion symbol here?
            int numCards = slot.getRight().intValue();

            String[] sType = TextUtil.splitWithParenthesis(slotType, ' ');
            String setCode = sType.length == 1 && booster.getEdition() != null ?  booster.getEdition() : null;
            String sheetKey = StaticData.instance().getEditions().contains(setCode) ? slotType.trim() + " " + setCode: slotType.trim();

            if (foilSlot == null || !foilSlot.equals(slotType)) {
                PrintSheet ps = getPrintSheet(sheetKey);
                result.addAll(ps.random(numCards, true));
            } else {
                PrintSheet ps = getPrintSheet(sheetKey);
                result.addAll(ps.random(numCards - 1, true));
                result.add(generateFoilCard(booster));
            }
        }
        return result;
    }
2) As far as UI support goes, the support for foils in the deck editors is incomplete, and potentially I'd need some "backup" from our UI coders (most likely drdev, in particular, since he's potentially our one and only expert at deck editor UI at the moment) at least at some time in the future. In particular:
- as of right now, the foil finish is not displayed in the deck editor in pile view;
- the foil finish is not displayed in the booster card lists (such as e.g. when you win a booster in quest mode and look through the contents);
- in constructed mode, there is no way to specify that a card is foil or not (maybe it's worth adding some kind of a "Toggle Foil" option to the right-click context menu that would toggle between a foil and non-foil card?..);
- in the deck editors, there is no way to distinguish that a card is foil while in list view mode (e.g. MTGO displays such cards with a star icon).

3) Very importantly, there is currently no way to turn foil support on or off (I admit that there may be people who may not want to use foils in their games). I understand that it's undesirable (and potentially not even possible) to propagate a UI property to anywhere outside forge.gui, so I believe this has to be implemented somehow differently. However, I'm not sure what the best implementation strategy should be here, so I'm open to suggestions. - Agree with Max here, foils in boosters are an official thing, so for authenticity they should be generated in boosters; in Constructed decks foils will always be an option anyway.

4) As of right now, there is some kind of a bug in card name processing code that does not recognize foil cards saved with the foil suffix (+) saved in the very end of the card name after the set and art index (e.g. Forest|ZEN|3+). Only the Forest+|ZEN|3 syntax is recognized, but the game saves the foil suffix in the end. I'm currently working on getting this fixed. - FIXED (now appending the foil suffix to the card name anyway, looks better and is recognized correctly).

- Agetian
Last edited by Agetian on 08 Feb 2014, 14:58, edited 3 times in total.
Agetian
Programmer
 
Posts: 3472
Joined: 14 Mar 2011, 05:58
Has thanked: 677 times
Been thanked: 561 times

Re: Forge version 1.5.13

Postby Max mtg » 08 Feb 2014, 13:52

1.
* for code clarity - throw dice to learn if this booster has a Foil right in getBooster method.
* if there is to be foil in a booster, put 1 card less into the seleted slot, but remember all sheets used in booster (or their keys - no matter). Then roll dice to determine which sheet to use for foil card generation , generate one card, call CardDb.getFoiled, add it to booster and you're done. === This is how you'll be able to add RTR foiled lands into GTC boosters. I've seen those myself.

3. There'll be no option to turn foiling off. WotC does not release foil-less boosters.
Single class for single responsibility.
Max mtg
Programmer
 
Posts: 1997
Joined: 02 Jul 2011, 14:26
Has thanked: 173 times
Been thanked: 334 times

Re: Forge version 1.5.13

Postby drdev » 08 Feb 2014, 15:08

I can look into adding foil support to the Deck Editor. However I'd propose we do add a setting that would allow disabling the foil appearance of card images. This would affect GUI only, the cards would still be marked as foil in the model. It would just allow people who maybe don't like the look of foils to be able to view them as regular cards while building decks and playing.

Does that sound like a reasonable setting?
drdev
Programmer
 
Posts: 1958
Joined: 27 Jul 2013, 02:07
Has thanked: 189 times
Been thanked: 565 times

Re: Forge version 1.5.13

Postby Agetian » 08 Feb 2014, 15:11

@ drdev: Sounds fine by me! Thank you for agreeing to look into it!

- Agetian
Agetian
Programmer
 
Posts: 3472
Joined: 14 Mar 2011, 05:58
Has thanked: 677 times
Been thanked: 561 times

Re: Forge version 1.5.13

Postby Max mtg » 08 Feb 2014, 15:15

I've added some code into ManaPool to be able to spend mana of certain color as if it were mana of different color to support Cards mentioned in that post: viewtopic.php?p=129528#p129528

There's a field colorConversionMatrix into ManaPool class. That is an array of 6 bytes, each standing for one of the five colors with the last byte added for colorless. Each byte can be assigned any combination of MagicColor constants.

So if you assign colorConversionMatrix[0] = MagicColor.WHITE | MagicColor.RED that is to say that {W} (white) mana (0-th index in "WUBRG" list) can be spent to pay for shards of white and red color - that's the effect of Sunglasses of Urza.
Another example: colorConversionMatrix[5] = MagicColor.ALL_COLORS <- colorless mana can be spent to pay for any color in cost.

There's no method to assign that values (please implement one), but there's a method to reset matrix to identity forge.game.mana.ManaPool.restoreColorReplacements(). Who can implement the rest?
Last edited by Max mtg on 08 Feb 2014, 17:19, edited 1 time in total.
Single class for single responsibility.
Max mtg
Programmer
 
Posts: 1997
Joined: 02 Jul 2011, 14:26
Has thanked: 173 times
Been thanked: 334 times

Re: Forge version 1.5.13

Postby Agetian » 08 Feb 2014, 16:18

@ drdev: I committed the initial implementation of booster pack foil generation, feel free to improve the UI backing for it and add the option to disable visual display of foils. Thanks a lot in advance!

@ Max: I tried to add the "add replacement color" method, not sure if that's what was meant (seemed too simple to be true somehow :\ ), please check - if I did the wrong thing I can kill it. :)

- Agetian
Agetian
Programmer
 
Posts: 3472
Joined: 14 Mar 2011, 05:58
Has thanked: 677 times
Been thanked: 561 times

Re: Forge version 1.5.13

Postby friarsol » 08 Feb 2014, 16:44

Agetian wrote:@ Max: I tried to add the "add replacement color" method, not sure if that's what was meant (seemed too simple to be true somehow :\ ), please check - if I did the wrong thing I can kill it. :)
I believe what Max is asking for is hooking up the code he just wrote to something that scripts hook into. (Probably in the form of a static ability or two)
friarsol
Global Moderator
 
Posts: 7593
Joined: 15 May 2010, 04:20
Has thanked: 243 times
Been thanked: 965 times

Re: Forge version 1.5.13

Postby Agetian » 08 Feb 2014, 16:53

@ friarsol: Yeah, that would be the next step indeed. I'd probably not be the best man to look into that, though if no one takes care of it I may look into it eventually (no promises though).

- Agetian
Agetian
Programmer
 
Posts: 3472
Joined: 14 Mar 2011, 05:58
Has thanked: 677 times
Been thanked: 561 times

Re: Forge version 1.5.13

Postby Agetian » 08 Feb 2014, 19:40

As of r24741, there's an issue with the display of foil overlay in CardManager, noticeable at least in sealed deck generation (probably it's universal, it's just easy to reproduce it by using sealed deck generation): if you generate a sealed deck and it's going to have a foil in it (or several foils), the foil overlay will not be displayed on the foil card until you hover the mouse over it (at which point it will switch the card to foil and then keep displaying its foil overlay correctly).

P.S. I added a property to turn the foil overlay display on and off.

- Agetian
Last edited by Agetian on 08 Feb 2014, 19:56, edited 1 time in total.
Agetian
Programmer
 
Posts: 3472
Joined: 14 Mar 2011, 05:58
Has thanked: 677 times
Been thanked: 561 times

Re: Forge version 1.5.13

Postby friarsol » 08 Feb 2014, 19:50

I'll take a look this afternoon at the ManaConversion Static Abilities. I know Sloth usually handles these. If I make any significant progress I'll post about it.
friarsol
Global Moderator
 
Posts: 7593
Joined: 15 May 2010, 04:20
Has thanked: 243 times
Been thanked: 965 times

Re: Forge version 1.5.13

Postby drdev » 08 Feb 2014, 20:06

Agetian wrote:As of r24741, there's an issue with the display of foil overlay in CardManager, noticeable at least in sealed deck generation (probably it's universal, it's just easy to reproduce it by using sealed deck generation): if you generate a sealed deck and it's going to have a foil in it (or several foils), the foil overlay will not be displayed on the foil card until you hover the mouse over it (at which point it will switch the card to foil and then keep displaying its foil overlay correctly).

P.S. I added a property to turn the foil overlay display on and off.

- Agetian
I'll look into it.

EDIT: Fixed in r24747. I wasn't properly assigning a random foil effect to the Card object despite the isFoil() property of the PaperCard object returning true.

It was exciting, the first draft I ran with the fix in place the first pack had a foil Huntmaster of the Fells. Can't say I've ever had the fortune to open a foil money mythic in a paper or MTGO draft before. Almost a shame it isn't worth anything on Forge. :D
drdev
Programmer
 
Posts: 1958
Joined: 27 Jul 2013, 02:07
Has thanked: 189 times
Been thanked: 565 times

Re: Forge version 1.5.13

Postby friarsol » 09 Feb 2014, 01:32

Looks like I have Additive Mana Conversion working. Still running some tests, but I'll try to commit the initial version of it this evening at some point. Once I get that in, I'll look into the best way to get Restrictive working more accurately than how it would work if a script was written right now. (Celestial Dawn is the only card with a restrictive mana conversion, and I won't commit it with the inital code.)
friarsol
Global Moderator
 
Posts: 7593
Joined: 15 May 2010, 04:20
Has thanked: 243 times
Been thanked: 965 times

Re: Forge version 1.5.13

Postby drdev » 09 Feb 2014, 02:42

There's a bug in the new booster pack generation. I just got a pack with no rare or mythic because one of the commons is a foil. A pack should always have a rare or mythic, regardless of foils.
drdev
Programmer
 
Posts: 1958
Joined: 27 Jul 2013, 02:07
Has thanked: 189 times
Been thanked: 565 times

Next

Return to Developer's Corner

Who is online

Users browsing this forum: No registered users and 77 guests


Who is online

In total there are 77 users online :: 0 registered, 0 hidden and 77 guests (based on users active over the past 10 minutes)
Most users ever online was 4143 on 23 Jan 2024, 08:21

Users browsing this forum: No registered users and 77 guests

Login Form