It is currently 18 Apr 2024, 23:26
   
Text Size

Foil rarity fix (partial)

Post MTG Forge Related Programming Questions Here

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

Foil rarity fix (partial)

Postby Seravy » 28 Jun 2017, 22:36

I succeeded in improving the distribution of various rarity foils in packs.

What this patch does :
-Implement individual chances for rarities instead of each rarity being equal
-Rare has 1/6 chance, Uncommon 2/6, Common 3/6. Rare can also be Mythic if available in the slot - chance is same as the nonfoil. Common can be a Basic Land at a 1/11 chance if there is such a slot in the pack.
-Supports packs with normal and "replace in common slot"
foils.
-Supports Timeshifted Time Spiral slots (untested so far, can't guarantee it works)

What it does not do :
-No support for sets with nonstandard slot names such as "Common!dsp" or "Basic Land xyz", whatever those are. I have long since stopped playing before these sets were released so I have no idea what they are for. These sets will fail to generate foils.
-I have no idea how it reacts to "foil sheets". I left code regarding that untouched so it should be unchanged, whether that means it stays buggy or was never buggy in the first place, idk. Again, these are sets I know nothing about.
-Multiple foils per pack is not implemented. In old type packs, you could have one foil of each rarity in the same pack as far as I remember - but it was very rare to find such a pack (like one in 3 full boxes). Unless I remember wrong.
-Ratios are not official. I couldn't find official information so I had to rely on my own experiences and whatever rumors I found.
-Each pack has the same 21.43% chance of a foil (1 in 70 cards), and I left that unchanged. This is an official number, but in reality, it only applied to some packs. Older packs had 1:100, and newer packs had 1:58 AFAIK. These details are ignored.
- Haven't looked at tournament packs yet - this is (I think) for boosters only.

...and with this, I can FINALLY start playing again... and hope no bugs surface from all these patches.
Attachments
FoilRarityFix.txt
(7.18 KiB) Downloaded 205 times
Seravy
 
Posts: 363
Joined: 26 Oct 2016, 21:23
Has thanked: 5 times
Been thanked: 27 times

Re: Foil rarity fix (partial)

Postby Agetian » 29 Jun 2017, 13:53

Hmm, I think this is a rather discussible patch for the time being, I'd vote on improving it before integration. For instance, these specific points make me feel rather uncomfortable:

Seravy wrote:- No support for sets with nonstandard slot names such as "Common!dsp" or "Basic Land xyz", whatever those are. I have long since stopped playing before these sets were released so I have no idea what they are for. These sets will fail to generate foils.
This probably means that most recent sets will not generate any foils. For example, the "Basic Land XXX" syntax is used to provide a land set code for sets which do not feature basic lands by themselves. This means that pretty much any small expansion uses it (e.g. in the Kaladesh block, Aether Revolt would use it since it does not contain any basic lands).
The fact that your change breaks foil generation for these sets, as well as in other circumstances, is a blocker.

Seravy wrote:-I have no idea how it reacts to "foil sheets". I left code regarding that untouched so it should be unchanged, whether that means it stays buggy or was never buggy in the first place, idk. Again, these are sets I know nothing about.
This most likely has to do with all the new sets that utilize an additional foil print sheet (the Masterpieces). This needs to be tested, since all recent sets use it and newer sets will continue to be using it, so this also blocks integration until figured out and resolved.

Seravy wrote:-Ratios are not official. I couldn't find official information so I had to rely on my own experiences and whatever rumors I found.
This is not a blocker in my opinion, but it would be nice to ask around if anyone has more precise information on what the chances should be like.

Anyway, this is a good effort! I hope someone can help figure out and patch up those remaining points above (the first two, in particular), such that it can be integrated upstream.

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

Re: Foil rarity fix (partial)

Postby Seravy » 29 Jun 2017, 14:07

I hope someone can help figure out and patch up those remaining points above (the first two, in particular), such that it can be integrated upstream.
I second this, while I'm not going to play with new sets for a while, eventually I will get to unlocking them and will want foils too :)

Also, looked at Tournament pack code meanwhile - as far as I can tell they use booster pack code to be generated so I guess the patch applies to them - but it means a pack has the same chance of foils as a booster while is probably wrong (as a pack is essentially 3 boosters worth of cards, not one). So there is a lot to improve here, but at least it's a start. (also have have zero knowledge about foil chances in tournament packs. I do remember some sets guaranteed a foil basic land though.)
Seravy
 
Posts: 363
Joined: 26 Oct 2016, 21:23
Has thanked: 5 times
Been thanked: 27 times

Re: Foil rarity fix (partial)

Postby Seravy » 29 Jun 2017, 20:07

Discovered a bug in this patch - it seems to be crashing the game when there is no quest world format (unrestricted) as that generates "packs" of the "null" edition for the shop - I wasn't expecting that.

This time I'm not going to take risks. I've set shop single packs to 100 (with a ratio of 1/3/11 resembling real packs) and generated several sets of 100 packs. The ratio of each rarity was correct (though the distribution was very random, much more than real world booster boxes, there was a set of 100 packs with zero foil rares and another with 8 of them).

Something more important : Added a special case - if no valid slot type can be found for the rolled rarity in the pack, it uses the old "pick one of the slot types at random, equal chance for each" system. This should make it "safe" for newer packs with those extra codes. Still, it would be nice if someone could make the distribution properly work for it (or, explain me what each of those special rarity names mean and then I can do it myself), also, this feature is currently untested.

Fixed version attached.

..or not, still getting crashes. I just realized I was looking at the wrong file too, BoosterGenerator is not BoosterUtil lol maaaan I want to play...
Seravy
 
Posts: 363
Joined: 26 Oct 2016, 21:23
Has thanked: 5 times
Been thanked: 27 times

Re: Foil rarity fix (partial)

Postby Seravy » 29 Jun 2017, 22:43

Well crash is gone (was caused by the world patch), so far so good.

But I realized a problem.
Formatless quests in a formatless world create "null" edition boosters. Which from what I observed in the game, contain any card.
However, "null" edition boosters don't have foils. It's explicitly part of the code. They might contain any card, including from sets that don't support foils - so they can't have them either. Which means, games played on no format have no foils among shop singles - or whatever other source of cards that come from a "null" set. Not sure what the desired solution to this problem is but it feels wrong to not be able to find foils at all instead of only if the card is of a nonfoil edition.

Either way, this is the latest version of the patch file :
FoilRarityFix.txt
(7.5 KiB) Downloaded 203 times
Seravy
 
Posts: 363
Joined: 26 Oct 2016, 21:23
Has thanked: 5 times
Been thanked: 27 times


Return to Developer's Corner

Who is online

Users browsing this forum: No registered users and 46 guests


Who is online

In total there are 46 users online :: 0 registered, 0 hidden and 46 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 46 guests

Login Form