mirror of
https://github.com/mwisnowski/mtg_python_deckbuilder.git
synced 2025-12-17 08:00:13 +01:00
Added logic to tagger and deck_builder for "hidden themes" related to multiple-copy cards, such as Hare Apparent or Dragon's Approach
This commit is contained in:
parent
c74d1ff03a
commit
0dfe53bb32
3 changed files with 561 additions and 304 deletions
728
deck_builder.py
728
deck_builder.py
File diff suppressed because it is too large
Load diff
|
|
@ -114,8 +114,8 @@ enchantment_tokens = ['Cursed Role', 'Monster Role', 'Royal Role', 'Sorcerer Rol
|
||||||
'Virtuous Role', 'Wicked Role', 'Young Hero Role', 'Shard']
|
'Virtuous Role', 'Wicked Role', 'Young Hero Role', 'Shard']
|
||||||
|
|
||||||
multiple_copy_cards = ['Dragon\'s Approach', 'Hare Apparent', 'Nazgûl', 'Persistent Petitioners',
|
multiple_copy_cards = ['Dragon\'s Approach', 'Hare Apparent', 'Nazgûl', 'Persistent Petitioners',
|
||||||
'Rat Colony','Relentless Rars', 'Seven Dwarves', 'Shadowborn Apostle',
|
'Rat Colony', 'Relentless Rats', 'Seven Dwarves', 'Shadowborn Apostle',
|
||||||
'Slime Against Humanity', 'Templar Knights']
|
'Slime Against Humanity', 'Templar Knight']
|
||||||
|
|
||||||
non_creature_types = ['Legendary', 'Creature', 'Enchantment', 'Artifact',
|
non_creature_types = ['Legendary', 'Creature', 'Enchantment', 'Artifact',
|
||||||
'Battle', 'Sorcery', 'Instant', 'Land', '-', '—',
|
'Battle', 'Sorcery', 'Instant', 'Land', '-', '—',
|
||||||
|
|
|
||||||
47
tagger.py
47
tagger.py
|
|
@ -5,7 +5,7 @@ import pandas as pd # type: ignore
|
||||||
|
|
||||||
import settings
|
import settings
|
||||||
|
|
||||||
from settings import artifact_tokens, csv_directory, colors, counter_types, enchantment_tokens, num_to_search, triggers
|
from settings import artifact_tokens, csv_directory, colors, counter_types, enchantment_tokens, multiple_copy_cards, num_to_search, triggers
|
||||||
from setup import regenerate_csv_by_color
|
from setup import regenerate_csv_by_color
|
||||||
from utility import pluralize, sort_list
|
from utility import pluralize, sort_list
|
||||||
|
|
||||||
|
|
@ -3176,10 +3176,14 @@ def tag_for_themes(df, color):
|
||||||
print('==========\n')
|
print('==========\n')
|
||||||
search_for_legends(df, color)
|
search_for_legends(df, color)
|
||||||
print('==========\n')
|
print('==========\n')
|
||||||
|
tag_for_little_guys(df, color)
|
||||||
|
print('==========\n')
|
||||||
tag_for_mill(df, color)
|
tag_for_mill(df, color)
|
||||||
print('==========\n')
|
print('==========\n')
|
||||||
tag_for_monarch(df, color)
|
tag_for_monarch(df, color)
|
||||||
print('==========\n')
|
print('==========\n')
|
||||||
|
tag_for_multiple_copies(df, color)
|
||||||
|
print('==========\n')
|
||||||
tag_for_planeswalkers(df, color)
|
tag_for_planeswalkers(df, color)
|
||||||
print('==========\n')
|
print('==========\n')
|
||||||
tag_for_reanimate(df, color)
|
tag_for_reanimate(df, color)
|
||||||
|
|
@ -3703,6 +3707,32 @@ def search_for_legends(df, color):
|
||||||
|
|
||||||
print(f'"Legends Matter" and "Historics Matter" cards in {color}_cards.csv have been tagged.\n')
|
print(f'"Legends Matter" and "Historics Matter" cards in {color}_cards.csv have been tagged.\n')
|
||||||
|
|
||||||
|
## Little Fellas
|
||||||
|
def tag_for_little_guys(df, color):
|
||||||
|
print(f'Tagging cards in {color}_cards.csv that are or care about low-power (2 or less) creatures.')
|
||||||
|
for index, row in df.iterrows():
|
||||||
|
theme_tags = row['themeTags']
|
||||||
|
if pd.notna(row['power']):
|
||||||
|
if '*' in row['power']:
|
||||||
|
continue
|
||||||
|
if (int(row['power']) <= 2):
|
||||||
|
tag_type = ['Little Fellas']
|
||||||
|
for tag in tag_type:
|
||||||
|
if tag not in theme_tags:
|
||||||
|
theme_tags.extend([tag])
|
||||||
|
df.at[index, 'themeTags'] = theme_tags
|
||||||
|
|
||||||
|
if pd.notna(row['text']):
|
||||||
|
if ('power 2 or less' in row['text'].lower()
|
||||||
|
):
|
||||||
|
tag_type = ['Little Fellas']
|
||||||
|
for tag in tag_type:
|
||||||
|
if tag not in theme_tags:
|
||||||
|
theme_tags.extend([tag])
|
||||||
|
df.at[index, 'themeTags'] = theme_tags
|
||||||
|
|
||||||
|
print(f'Low-power (2 or less) creature cards in {color}_cards.csv have been tagged.\n')
|
||||||
|
|
||||||
## Mill
|
## Mill
|
||||||
def tag_for_mill(df, color):
|
def tag_for_mill(df, color):
|
||||||
print(f'Tagging cards in {color}_cards.csv that have a "Mill" theme.')
|
print(f'Tagging cards in {color}_cards.csv that have a "Mill" theme.')
|
||||||
|
|
@ -3780,6 +3810,21 @@ def tag_for_monarch(df, color):
|
||||||
|
|
||||||
print(f'"Monarch" cards in {color}_cards.csv have been tagged.\n')
|
print(f'"Monarch" cards in {color}_cards.csv have been tagged.\n')
|
||||||
|
|
||||||
|
## Multi-copy cards
|
||||||
|
def tag_for_multiple_copies(df, color):
|
||||||
|
print(f'Tagging cards in {color}_cards.csv that allow having multiple copies.')
|
||||||
|
for index, row in df.iterrows():
|
||||||
|
theme_tags = row['themeTags']
|
||||||
|
if (row['name'] in multiple_copy_cards
|
||||||
|
):
|
||||||
|
tag_type = ['Multiple Copies', row['name']]
|
||||||
|
for tag in tag_type:
|
||||||
|
if tag not in theme_tags:
|
||||||
|
theme_tags.extend([tag])
|
||||||
|
df.at[index, 'themeTags'] = theme_tags
|
||||||
|
|
||||||
|
print(f'"Multiple-copy" cards in {color}_cards.csv have been tagged.\n')
|
||||||
|
|
||||||
## Planeswalkers
|
## Planeswalkers
|
||||||
def tag_for_planeswalkers(df, color):
|
def tag_for_planeswalkers(df, color):
|
||||||
print(f'Tagging cards in {color}_cards.csv that fit the "Planeswalkers/Super Friends" theme.')
|
print(f'Tagging cards in {color}_cards.csv that fit the "Planeswalkers/Super Friends" theme.')
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue