122 lines
4 KiB
Python
122 lines
4 KiB
Python
|
|
#!/usr/bin/env python3
|
||
|
|
"""
|
||
|
|
Add Lorcana sample cards to the database
|
||
|
|
"""
|
||
|
|
|
||
|
|
import sys
|
||
|
|
import os
|
||
|
|
|
||
|
|
# Add the backend directory to the path so we can import our modules
|
||
|
|
sys.path.append(os.path.dirname(__file__))
|
||
|
|
|
||
|
|
from app.database import SessionLocal
|
||
|
|
from app.models.card import Card
|
||
|
|
|
||
|
|
|
||
|
|
def add_lorcana_cards():
|
||
|
|
"""Add sample Lorcana cards to the database"""
|
||
|
|
|
||
|
|
lorcana_cards = [
|
||
|
|
{
|
||
|
|
"name": "Mickey Mouse - Brave Little Tailor",
|
||
|
|
"game": "LORCANA",
|
||
|
|
"set_name": "The First Chapter",
|
||
|
|
"set_code": "TFC",
|
||
|
|
"card_number": "001",
|
||
|
|
"rarity": "Legendary",
|
||
|
|
"mana_cost": "8",
|
||
|
|
"cmc": 8,
|
||
|
|
"card_type": "Character - Storyborn Hero",
|
||
|
|
"colors": ["Amber"],
|
||
|
|
"oracle_text": "Evasive (Only characters with Evasive can challenge this character.) Support (Whenever this character quests, you may add their Lore to another chosen character's Lore this turn.)",
|
||
|
|
"power": "5",
|
||
|
|
"toughness": "8",
|
||
|
|
"current_price": 15.99,
|
||
|
|
"market_price": 14.50,
|
||
|
|
"verified": True
|
||
|
|
},
|
||
|
|
{
|
||
|
|
"name": "Elsa - Snow Queen",
|
||
|
|
"game": "LORCANA",
|
||
|
|
"set_name": "The First Chapter",
|
||
|
|
"set_code": "TFC",
|
||
|
|
"card_number": "216",
|
||
|
|
"rarity": "Super Rare",
|
||
|
|
"mana_cost": "8",
|
||
|
|
"cmc": 8,
|
||
|
|
"card_type": "Character - Storyborn Queen Sorcerer",
|
||
|
|
"colors": ["Sapphire"],
|
||
|
|
"oracle_text": "Deep Freeze - Exert chosen opposing character. They can't ready at the start of their next turn.",
|
||
|
|
"power": "4",
|
||
|
|
"toughness": "6",
|
||
|
|
"current_price": 8.99,
|
||
|
|
"market_price": 9.50,
|
||
|
|
"verified": True
|
||
|
|
},
|
||
|
|
{
|
||
|
|
"name": "Be Prepared",
|
||
|
|
"game": "LORCANA",
|
||
|
|
"set_name": "The First Chapter",
|
||
|
|
"set_code": "TFC",
|
||
|
|
"card_number": "087",
|
||
|
|
"rarity": "Rare",
|
||
|
|
"mana_cost": "3",
|
||
|
|
"cmc": 3,
|
||
|
|
"card_type": "Action - Song",
|
||
|
|
"colors": ["Emerald"],
|
||
|
|
"oracle_text": "(A character with cost 3 or more can sing this song for free.) Deal 2 damage to chosen character.",
|
||
|
|
"current_price": 2.99,
|
||
|
|
"market_price": 3.25,
|
||
|
|
"verified": True
|
||
|
|
},
|
||
|
|
{
|
||
|
|
"name": "Mickey Mouse - Steamboat Pilot",
|
||
|
|
"game": "LORCANA",
|
||
|
|
"set_name": "The First Chapter",
|
||
|
|
"set_code": "TFC",
|
||
|
|
"card_number": "019",
|
||
|
|
"rarity": "Common",
|
||
|
|
"mana_cost": "2",
|
||
|
|
"cmc": 2,
|
||
|
|
"card_type": "Character - Storyborn Captain",
|
||
|
|
"colors": ["Amber"],
|
||
|
|
"oracle_text": "Shift 4 (You may pay 4 ink to play this on top of another Mickey Mouse character.)",
|
||
|
|
"power": "2",
|
||
|
|
"toughness": "2",
|
||
|
|
"current_price": 0.25,
|
||
|
|
"market_price": 0.30,
|
||
|
|
"verified": True
|
||
|
|
}
|
||
|
|
]
|
||
|
|
|
||
|
|
db = SessionLocal()
|
||
|
|
try:
|
||
|
|
added_count = 0
|
||
|
|
for card_data in lorcana_cards:
|
||
|
|
# Check if card already exists
|
||
|
|
existing_card = db.query(Card).filter(
|
||
|
|
Card.name == card_data["name"],
|
||
|
|
Card.set_name == card_data["set_name"]
|
||
|
|
).first()
|
||
|
|
|
||
|
|
if not existing_card:
|
||
|
|
card = Card(**card_data)
|
||
|
|
db.add(card)
|
||
|
|
added_count += 1
|
||
|
|
print(f"✅ Added Lorcana card: {card.name}")
|
||
|
|
else:
|
||
|
|
print(f"⚠️ Lorcana card already exists: {existing_card.name}")
|
||
|
|
|
||
|
|
db.commit()
|
||
|
|
print(f"\n🎉 Successfully added {added_count} new Lorcana cards!")
|
||
|
|
|
||
|
|
except Exception as e:
|
||
|
|
print(f"❌ Error adding Lorcana cards: {e}")
|
||
|
|
db.rollback()
|
||
|
|
finally:
|
||
|
|
db.close()
|
||
|
|
|
||
|
|
|
||
|
|
if __name__ == "__main__":
|
||
|
|
print("🃏 Adding Lorcana sample cards...")
|
||
|
|
add_lorcana_cards()
|