It is currently 09 Sep 2025, 00:23
   
Text Size

Patch: Different sets for quest shop lands

Post MTG Forge Related Programming Questions Here

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

Patch: Different sets for quest shop lands

Postby 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
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

Postby 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
Code: Select all
return CardDb.instance().isCardSupported("Plains", editionCode);
Test this way each of allowedSetCodes in quest or (if no limit is enforced) iterate over Singeltons.getModel().getEditions()
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

Postby Agetian » 30 Oct 2012, 11:21

Max mtg wrote:That getAllowedSetCodesWithLands is too complex

If you want to test if a certain set has basic lands, use
Code: Select all
return CardDb.instance().isCardSupported("Plains", editionCode);
Test this way each of allowedSetCodes in quest or (if no limit is enforced) iterate over Singeltons.getModel().getEditions()
Oh, gotcha, I'll modify the code appropriately and post a new version of the patch. :) Thanks for the tip!
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

Postby 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
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

Postby Max mtg » 30 Oct 2012, 11:58

Code: Select all
landCodes = Iterables.filter(Singletons.getModel().getEditions(), CardEdition.Predicates.hasBasicLands)
You are also recieve all lands from different sets.
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

Postby Agetian » 30 Oct 2012, 17:27

Max mtg wrote:
Code: Select all
landCodes = Iterables.filter(Singletons.getModel().getEditions(), CardEdition.Predicates.hasBasicLands)
You are also recieve all lands from different sets.
Took this into consideration and committed to SVN, thus making my first commit. Tested as much as I could, hope everything works fine.

- 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

Postby 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 :)
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

Postby 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


Return to Developer's Corner

Who is online

Users browsing this forum: No registered users and 53 guests

Main Menu

User Menu

Our Partners


Who is online

In total there are 53 users online :: 0 registered, 0 hidden and 53 guests (based on users active over the past 10 minutes)
Most users ever online was 7303 on 15 Jul 2025, 20:46

Users browsing this forum: No registered users and 53 guests

Login Form