Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support is:dfc and is:mdfc in card search, fix is:gainland #12224

Merged
merged 3 commits into from Apr 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
20 changes: 20 additions & 0 deletions find/find_test.py
Expand Up @@ -110,6 +110,22 @@ def test_multi_faced_cards() -> None:
do_functional_test(s, ['Hanweir Battlements', 'Hanweir Garrison'], ['Hanweir, the Writhing Township'])
s = 'is:split'
do_functional_test(s, ['Driven // Despair', 'Fire // Ice', 'Wear // Tear'], ['Budoka Gardener', 'Hanweir Garrison'])
s = 'is:flip'
do_functional_test(s, ['Budoka Gardener'], ['Hanweir Garrison', 'Fire // Ice'])
s = 'is:transform'
do_functional_test(s, ['Delver of Secrets', "Jace, Vryn's Prodigy"], ['Budoka Gardener', 'Hanweir Garrison', 'Fire // Ice'])
s = 'is:meld'
do_functional_test(s, ['Hanweir Garrison', 'Phyrexian Dragon Engine'], ['Budoka Gardener', 'Fire // Ice'])
s = 'is:leveler'
do_functional_test(s, ['Hexdrinker', 'Joraga Treespeaker'], ['Budoka Gardener', 'Fire // Ice'])
s = 'is:dfc'
do_functional_test(s, ['Delver of Secrets', 'Barkchannel Pathway'], ['Budoka Gardener', 'Fire // Ice'])
s = 'is:dfc -is:mdfc'
do_functional_test(s, ['Delver of Secrets'], ['Barkchannel Pathway'])
s = 'is:mdfc'
do_functional_test(s, ["Agadeem's Awakening", 'Bala Ged Recovery', 'Barkchannel Pathway'], ['Delver of Secrets', 'Budoka Gardener', 'Fire // Ice'])
s = 'is:mdfc AND is:dfc'
do_functional_test(s, ["Agadeem's Awakening", 'Bala Ged Recovery', 'Barkchannel Pathway'], ['Delver of Secrets', 'Budoka Gardener', 'Fire // Ice'])

@pytest.mark.functional
def test_spells_permanents_and_effects() -> None:
Expand Down Expand Up @@ -541,6 +557,10 @@ def test_is_triland_functional() -> None:
def test_is_checkland_functional() -> None:
do_functional_test('is:checkland', ['Drowned Catacomb', 'Hinterland Harbor'], ['Savage Lands'])

@pytest.mark.functional()
def test_is_gainland_functional() -> None:
do_functional_test('is:gainland', ['Akoum Refuge', 'Dismal Backwater'], ['City of Brass', 'Glimmerpost'])

@pytest.mark.functional()
def test_smart_quotes() -> None:
do_functional_test('o:“Art rampage”', ['Our Market Research Shows That Players Like Really Long Card Names So We Made this Card to Have the Absolute Longest Card Name Ever Elemental'], [])
Expand Down
6 changes: 5 additions & 1 deletion find/search.py
Expand Up @@ -398,6 +398,10 @@ def init_value_lookup() -> None:
VALUE_LOOKUP['color_identity'] = d

def is_subquery(subquery_name: str) -> str:
if subquery_name == 'dfc':
return "(c.layout IN ('transform', 'modal_dfc'))"
if subquery_name == 'mdfc':
subquery_name = 'modal_dfc'
if subquery_name in layout.all_layouts():
return f'(c.layout = {sqlescape(subquery_name)})'
if subquery_name == 'spikey':
Expand All @@ -412,7 +416,7 @@ def is_subquery(subquery_name: str) -> str:
'checkland': 't:land fo:"unless you control a" fo:"} or {"',
'creatureland': 't:land o:"becomes a"',
'fetchland': 't:land o:"Search your library for a " (o:"land card" or o:"plains card" or o:"island card" or o:"swamp card" or o:"mountain card" or o:"forest card" or o:"gate card")',
'gainland': 't:land o:"When ~ enters the battlefield, you gain 1 life"',
'gainland': 't:land o:"When ~ enters the battlefield, you gain 1 life."',
'painland': 't:land o:"~ deals 1 damage to you."',
'permanent': 't:artifact OR t:creature OR t:enchantment OR t:land OR t:planeswalker',
'slowland': """t:land o:"~ doesn't untap during your next untap step." """,
Expand Down