Patch: Different sets for quest shop lands
Post MTG Forge Related Programming Questions Here
Moderators: timmermac, Blacksmith, KrazyTheFox, Agetian, friarsol, CCGHQ Admins
8 posts
• Page 1 of 1
Patch: Different sets for quest shop lands
by Agetian » 30 Oct 2012, 10:31
As I said in another topic before, as a little warmup I'm working on implementing more varied lands in quest mode shop - currently it's always M10 for basic lands and ICE for snow-covered lands. The patch I'm submitting here (I don't have SVN commit access as of yet and I kind of want at least someone else to try this out before committing anyway) will make sure that each time the quest shop is regenerated, for each type of land and snow-covered land, a set will be chosen randomly (moreover, if a quest format is restricted, then the choice of random sets will be constrained to that quest format). Also, for the initial random card pool in quest mode, except for prebuilt deck lands, other basic lands are also randomly chosen from various sets (currently it's limited to one set per land type, so all Swamps will be from one set, all Forests from another, etc.). Hopefully this can get upstream eventually, at least after some more testing (I did test the basics, both in format-enforced and non-format-enforced mode, but who knows what I could have missed, it's my return to the project after ~2 years of being away from it :\ ).
The big question is: should I leave it on a per-type basis (so, all Islands from one set, etc.), or should I switch it to a per-card basis (so, each Island can be from its own set)? Each approach has its pros and cons, I think.
P.S. It's a NetBeans-generated diff file, I think it should be no different from any other diff file, but... I don't know, to be honest.
P.P.S. Currently the randomized land generator is an overload for the normal land generator. This way it can get removed (or the old version can be used when necessary) just in case.
P.P.P.S. Did my best to try and follow the original coding style, but not sure if I did everything right. Also, the code is likely to be a bit refactorable (due to my limited knowledge of the code base, I had to make some assumptions about what can be done and what can't be done, and certain things are likely to be possible in a more efficient and less cluttery way). I'm open to suggestions if anything needs to be done.
Anyways, here it is. Feedback is welcome.
EDIT: Ok it's uploaded now.
- Agetian
The big question is: should I leave it on a per-type basis (so, all Islands from one set, etc.), or should I switch it to a per-card basis (so, each Island can be from its own set)? Each approach has its pros and cons, I think.
P.S. It's a NetBeans-generated diff file, I think it should be no different from any other diff file, but... I don't know, to be honest.
P.P.S. Currently the randomized land generator is an overload for the normal land generator. This way it can get removed (or the old version can be used when necessary) just in case.
P.P.P.S. Did my best to try and follow the original coding style, but not sure if I did everything right. Also, the code is likely to be a bit refactorable (due to my limited knowledge of the code base, I had to make some assumptions about what can be done and what can't be done, and certain things are likely to be possible in a more efficient and less cluttery way). I'm open to suggestions if anything needs to be done.
Anyways, here it is. Feedback is welcome.

EDIT: Ok it's uploaded now.
- Agetian
- Attachments
-
quest_shop_random_lands_v2.zip
- Latest version of the patch
- (1.48 KiB) Downloaded 223 times
-
quest_shop_random_lands.zip
- OBSOLETE
- (1.76 KiB) Downloaded 213 times
Last edited by Agetian on 30 Oct 2012, 11:49, edited 1 time in total.
- Agetian
- Programmer
- Posts: 3489
- Joined: 14 Mar 2011, 05:58
- Has thanked: 684 times
- Been thanked: 572 times
Re: Patch: Different sets for quest shop lands
by Max mtg » 30 Oct 2012, 11:01
That getAllowedSetCodesWithLands is too complex
If you want to test if a certain set has basic lands, use
If you want to test if a certain set has basic lands, use
- Code: Select all
return CardDb.instance().isCardSupported("Plains", editionCode);
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: Patch: Different sets for quest shop lands
by Agetian » 30 Oct 2012, 11:21
Oh, gotcha, I'll modify the code appropriately and post a new version of the patch.Max mtg wrote:That getAllowedSetCodesWithLands is too complex
If you want to test if a certain set has basic lands, useTest this way each of allowedSetCodes in quest or (if no limit is enforced) iterate over Singeltons.getModel().getEditions()
- Code: Select all
return CardDb.instance().isCardSupported("Plains", editionCode);

- Agetian
- Programmer
- Posts: 3489
- Joined: 14 Mar 2011, 05:58
- Has thanked: 684 times
- Been thanked: 572 times
Re: Patch: Different sets for quest shop lands
by Agetian » 30 Oct 2012, 11:49
Ok, here's the fixed version, removed the abomination getAllowedSetCodesWithLands, changed as suggested into CardDb instance processing (that was a life saver, thanks Max mtg!
). Otherwise, functionally the same as v1.
- Agetian

- Agetian
- Attachments
-
quest_shop_random_lands_v2.zip
- (1.48 KiB) Downloaded 210 times
- Agetian
- Programmer
- Posts: 3489
- Joined: 14 Mar 2011, 05:58
- Has thanked: 684 times
- Been thanked: 572 times
Re: Patch: Different sets for quest shop lands
by Max mtg » 30 Oct 2012, 11:58
- Code: Select all
landCodes = Iterables.filter(Singletons.getModel().getEditions(), CardEdition.Predicates.hasBasicLands)
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: Patch: Different sets for quest shop lands
by Agetian » 30 Oct 2012, 17:27
Took this into consideration and committed to SVN, thus making my first commit. Tested as much as I could, hope everything works fine.Max mtg wrote:You are also recieve all lands from different sets.
- Code: Select all
landCodes = Iterables.filter(Singletons.getModel().getEditions(), CardEdition.Predicates.hasBasicLands)
- Agetian
- Agetian
- Programmer
- Posts: 3489
- Joined: 14 Mar 2011, 05:58
- Has thanked: 684 times
- Been thanked: 572 times
Re: Patch: Different sets for quest shop lands
by Max mtg » 30 Oct 2012, 20:03
Looking good.
My first commits were also somewhat related to quest mode. So it's a good point to start
My first commits were also somewhat related to quest mode. So it's a good point to start

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: Patch: Different sets for quest shop lands
by friarsol » 30 Oct 2012, 20:29
I worry that if lands from early editions are chosen it will be impossible to by basic lands due to cost. Not sure if this is legitimate concern dive I can't test it now
- friarsol
- Global Moderator
- Posts: 7593
- Joined: 15 May 2010, 04:20
- Has thanked: 243 times
- Been thanked: 965 times
8 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 53 guests