Page 1 of 1

Patch: Different sets for quest shop lands

PostPosted: 30 Oct 2012, 10:31
by Agetian
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

Re: Patch: Different sets for quest shop lands

PostPosted: 30 Oct 2012, 11:01
by Max mtg
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()

Re: Patch: Different sets for quest shop lands

PostPosted: 30 Oct 2012, 11:21
by Agetian
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!

Re: Patch: Different sets for quest shop lands

PostPosted: 30 Oct 2012, 11:49
by Agetian
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

Re: Patch: Different sets for quest shop lands

PostPosted: 30 Oct 2012, 11:58
by Max mtg
Code: Select all
landCodes = Iterables.filter(Singletons.getModel().getEditions(), CardEdition.Predicates.hasBasicLands)
You are also recieve all lands from different sets.

Re: Patch: Different sets for quest shop lands

PostPosted: 30 Oct 2012, 17:27
by Agetian
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

Re: Patch: Different sets for quest shop lands

PostPosted: 30 Oct 2012, 20:03
by Max mtg
Looking good.

My first commits were also somewhat related to quest mode. So it's a good point to start :)

Re: Patch: Different sets for quest shop lands

PostPosted: 30 Oct 2012, 20:29
by friarsol
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