Compare commits
2 Commits
2f69afc18b
...
4e3fd55b54
| Author | SHA1 | Date | |
|---|---|---|---|
| 4e3fd55b54 | |||
| da8f41cd8c |
@@ -171,11 +171,13 @@ WIKIDATA_INSTANCE_TYPE_MAP = {
|
|||||||
"Q1361229": CardType.event, # conquest
|
"Q1361229": CardType.event, # conquest
|
||||||
"Q2223653": CardType.event, # terrorist attack
|
"Q2223653": CardType.event, # terrorist attack
|
||||||
"Q2672648": CardType.event, # social conflict
|
"Q2672648": CardType.event, # social conflict
|
||||||
|
"Q2627975": CardType.event, # ceremony
|
||||||
"Q16510064": CardType.event, # sporting event
|
"Q16510064": CardType.event, # sporting event
|
||||||
"Q10688145": CardType.event, # season
|
"Q10688145": CardType.event, # season
|
||||||
"Q13418847": CardType.event, # historical event
|
"Q13418847": CardType.event, # historical event
|
||||||
"Q13406554": CardType.event, # sports competition
|
"Q13406554": CardType.event, # sports competition
|
||||||
"Q15275719": CardType.event, # recurring event
|
"Q15275719": CardType.event, # recurring event
|
||||||
|
"Q27968055": CardType.event, # recurring event edition
|
||||||
"Q114609228": CardType.event, # recurring sporting event
|
"Q114609228": CardType.event, # recurring sporting event
|
||||||
|
|
||||||
"Q7278": CardType.group, # political party
|
"Q7278": CardType.group, # political party
|
||||||
@@ -549,9 +551,9 @@ def compute_deck_type(cards: list) -> str | None:
|
|||||||
|
|
||||||
if all(c.cost > 6 for c in cards):
|
if all(c.cost > 6 for c in cards):
|
||||||
return "Unplayable"
|
return "Unplayable"
|
||||||
if sum(1 for c in cards if c.cost >= 10) == 1:
|
if sum(1 for c in cards if c.cost >= 7) == 1:
|
||||||
return "God Card"
|
return "God Card"
|
||||||
if sum(1 for c in cards if c.cost >= 10) > 1:
|
if sum(1 for c in cards if c.cost >= 7) > 1:
|
||||||
return "Pantheon"
|
return "Pantheon"
|
||||||
if avg_cost >= 3.2:
|
if avg_cost >= 3.2:
|
||||||
return "Control"
|
return "Control"
|
||||||
|
|||||||
@@ -59,10 +59,12 @@ def record_game_result(state: GameState, db: Session):
|
|||||||
if AI_USER_ID not in [winner_id_str, loser_id_str]:
|
if AI_USER_ID not in [winner_id_str, loser_id_str]:
|
||||||
deck = db.query(DeckModel).filter(DeckModel.id == uuid.UUID(winner_deck_id)).first()
|
deck = db.query(DeckModel).filter(DeckModel.id == uuid.UUID(winner_deck_id)).first()
|
||||||
if deck:
|
if deck:
|
||||||
|
deck.times_played += 1
|
||||||
deck.wins += 1
|
deck.wins += 1
|
||||||
|
|
||||||
deck = db.query(DeckModel).filter(DeckModel.id == uuid.UUID(loser_deck_id)).first()
|
deck = db.query(DeckModel).filter(DeckModel.id == uuid.UUID(loser_deck_id)).first()
|
||||||
if deck:
|
if deck:
|
||||||
|
deck.times_played += 1
|
||||||
deck.losses += 1
|
deck.losses += 1
|
||||||
|
|
||||||
db.commit()
|
db.commit()
|
||||||
@@ -188,12 +190,6 @@ async def try_match(db: Session):
|
|||||||
active_deck_ids[p1_entry.user_id] = p1_entry.deck_id
|
active_deck_ids[p1_entry.user_id] = p1_entry.deck_id
|
||||||
active_deck_ids[p2_entry.user_id] = p2_entry.deck_id
|
active_deck_ids[p2_entry.user_id] = p2_entry.deck_id
|
||||||
|
|
||||||
for entry, _ in [(p1_entry, p1_cards), (p2_entry, p2_cards)]:
|
|
||||||
deck = db.query(DeckModel).filter(DeckModel.id == uuid.UUID(entry.deck_id)).first()
|
|
||||||
if deck:
|
|
||||||
deck.times_played += 1
|
|
||||||
db.commit()
|
|
||||||
|
|
||||||
if not p1_cards or not p2_cards or not p1_user or not p2_user:
|
if not p1_cards or not p2_cards or not p1_user or not p2_user:
|
||||||
await send_error(p1_entry.websocket, "Failed to load deck")
|
await send_error(p1_entry.websocket, "Failed to load deck")
|
||||||
await send_error(p2_entry.websocket, "Failed to load deck")
|
await send_error(p2_entry.websocket, "Failed to load deck")
|
||||||
|
|||||||
@@ -47,7 +47,7 @@
|
|||||||
|
|
||||||
<div class="card-image-wrap">
|
<div class="card-image-wrap">
|
||||||
{#if card.image_link}
|
{#if card.image_link}
|
||||||
<img src={card.image_link} alt={card.name} class="card-image" />
|
<img src={card.image_link} alt={card.name} class="card-image" draggable="false"/>
|
||||||
{:else}
|
{:else}
|
||||||
<div class="card-image-placeholder">
|
<div class="card-image-placeholder">
|
||||||
<span>{card.name[0]}</span>
|
<span>{card.name[0]}</span>
|
||||||
|
|||||||
Reference in New Issue
Block a user