Merge branch 'vehicles' of https://github.com/SabreCat/mtgencode into SabreCat-vehicles

This commit is contained in:
Bill Zorn 2017-01-17 15:53:03 -08:00
commit 88f4331a78
2 changed files with 14 additions and 3 deletions

View file

@ -166,11 +166,15 @@ def fields_check_valid(fields):
return False return False
if not field_types in fields: if not field_types in fields:
return False return False
# creatures have p/t, other things don't # creatures and vehicles have p/t, other things don't
iscreature = False iscreature = False
for idx, value in fields[field_types]: for idx, value in fields[field_types]:
if 'creature' in value: if 'creature' in value:
iscreature = True iscreature = True
elif fields.get(field_subtypes):
for idx, value in fields[field_subtypes]:
if 'vehicle' in value:
iscreature = True
if iscreature: if iscreature:
return field_pt in fields return field_pt in fields
else: else:

View file

@ -63,8 +63,8 @@ def check_types(card):
return list_only(card.types, ['tribal', 'artifact', 'land', 'enchantment']) return list_only(card.types, ['tribal', 'artifact', 'land', 'enchantment'])
def check_pt(card): def check_pt(card):
if 'creature' in card.types or card.pt: if ('creature' in card.types or 'vehicle' in card.subtypes) or card.pt:
return (('creature' in card.types and len(re.findall(re.escape('/'), card.pt)) == 1) return ((('creature' in card.types or 'vehicle' in card.subtypes) and len(re.findall(re.escape('/'), card.pt)) == 1)
and not card.loyalty) and not card.loyalty)
if 'planeswalker' in card.types or card.loyalty: if 'planeswalker' in card.types or card.loyalty:
return (('planeswalker' in card.types and card.loyalty) return (('planeswalker' in card.types and card.loyalty)
@ -202,6 +202,12 @@ def check_equipment(card):
else: else:
return None return None
def check_vehicles(card):
if 'vehicle' in card.subtypes:
return 'crew' in card.text.text
else:
return None
def check_planeswalkers(card): def check_planeswalkers(card):
if 'planeswalker' in card.types: if 'planeswalker' in card.types:
good_lines = 0 good_lines = 0
@ -350,6 +356,7 @@ props = OrderedDict([
('quotes', check_quotes), ('quotes', check_quotes),
('auras', check_auras), ('auras', check_auras),
('equipment', check_equipment), ('equipment', check_equipment),
('vehicles', check_vehicles),
('planeswalkers', check_planeswalkers), ('planeswalkers', check_planeswalkers),
('levelup', check_levelup), ('levelup', check_levelup),
('chosen', check_chosen), ('chosen', check_chosen),