taw / magic-search-engine

Search engine for Magic cards
MIT License
47 stars 19 forks source link

add boosterfun token #163

Closed axxroytovu closed 1 year ago

axxroytovu commented 1 year ago

Add is:boosterfun and has:boosterfun search tokens

taw commented 1 year ago

There's a lot of promo cards matching is:boosterfun query. Also Contraption.

I'm also not sure why t:attraction doesn't match is:borderless.

So we probably need to define what's "boosterfun" a bit better than this.

axxroytovu commented 1 year ago

Fair.

Are there any other conditions you can think of?

axxroytovu commented 1 year ago

Updated with more rigorous logic.

taw commented 1 year ago

If the rules are really complicated, any chance we could maybe get mtgjson to maintain that data for us?

axxroytovu commented 1 year ago

I have an open issue over there, and I can ask. In the mean time I'll look for another logic solution.

axxroytovu commented 1 year ago

The specific logic problems I'm running into is that there are always exceptions to whatever rule I can come up with to filter the sets.

These always hold no matter what:

set.types.include("booster")
set.release_date > Date.new(2019, 10, 3)

All sets that have set.types.include?("standard") or set.types.include?("modern") have boosterfun.

But these filters have exceptions:

axxroytovu commented 1 year ago

Ok, I just discovered that mtgjson has a "promoTypes": ["boosterfun"] for cards that count as boosterfun. How can we incorporate that into the indexer?

axxroytovu commented 1 year ago

This version:

taw commented 1 year ago

If mtgjson is doing this, we should probably do support them all https://github.com/taw/magic-search-engine/issues/171

taw commented 1 year ago

So we have is:boosterfun now, basically card.promo_types.include?("boosterfun").

Is this returning what we want, or we want some different query?

(no has:booosterfun yet)

axxroytovu commented 1 year ago

Sort of. I had a go seeing if I could make it work with the current setup and I don't think I can. This is the best I could do for a "rare" sheet:

rare:
  any:
  - query: "r:r promo:boosterfun -is:foilonly -frame:extendedart"
    rate: 1
  - query: "r:r alt:(e:{set} promo:boosterfun -is:foilonly -frame:extendedart)"
    rate: 2
  - query: "r:r -alt:(e:{set} promo:boosterfun -is:foilonly -frame:extendedart)"
    rate: 3

If we did build a has:boosterfun using the current promo rules, it wouldn't work. It would also flag cards that only have foil or extended art treatments.

It's also just really clunky, and because the set code needs to be inside the alt tag I can't make this a sheet on the "common.yaml" file. Each booster would need their own sheet which defeats the point of the common sheets entirely.

Also, none of this currently works because the base query requires "is:booster," but that's a separate issue.

taw commented 1 year ago

This definition of a rare isn't too bad.

Some kind of {set} expansion inside queries would be straightforward, I just need to pick syntax that won't conflict with other query syntax. Then it could just be some complicated definition in common.yaml, and in booster definition just:

rare:
  use: rare_with_boosterfun

Would that be enough?

The first -is:foilonly is redundant as every foil and nonfoil query automatically does the right checks, but the ones in alt: are not redundant, so that's not saving much, and it might be more clear to be redundant here.

is:booster though indexer rules made a lot of sense back when cards beyond max were just for planeswalker decks, buy-a-box promos etc., and mtgjson was obsessed with including every single misprint etc. It's a bit clunky system since boosterfun, but I'm not sure other ways are better.

If promo:boosterfun -is:foilonly -frame:extendedart appears in a lot of queries we could give it some name (is:/has:draftboosterfun or something? ugh).

axxroytovu commented 1 year ago

Yeah I don't much like draftboosterfun either but I don't have any better ideas.

It might make more sense to have rare and rare_no_boosterfun instead, since the "default" now is to include boosterfun treatments. The only time you don't have boosterfun in a slot is in the common/uncommon cards in set and collector boosters. Old sets that don't have boosterfun treatments will have both sheets be the same, so it won't matter.

axxroytovu commented 1 year ago

Could it be a specific rule as part of the card_sheet_factory logic? Similar to how baseset is implemented?

taw commented 1 year ago

Do you want to try doing one or two boosters with just yaml, and then I'll see what can be done to improve the process?

I don't really know much about boosterfun, and non-draft boosters.

axxroytovu commented 1 year ago

This branch: https://github.com/taw/magic-search-engine/pull/172 has mostly functioning collector boosters, set boosters, and draft booster fun for ONE.

axxroytovu commented 1 year ago

This code no longer relevant. Should open new issue to simplify existing working YAML code.