Files
OpenFUT-Core/src/models/chemistry_style.rs
T
funman300 19c7b9989d
CI / Build, lint & test (push) Failing after 1m37s
Phase 10: card upgrade system (chemistry styles, position change, training)
- GET /chemistry-styles — lists 18 FUT-style chemistry styles with stat boost breakdowns
- POST /collection/:id/chemistry-style — apply a style (Shadow, Hunter, Anchor, etc.)
- POST /collection/:id/position — override a player's position for 500 coins
- POST /collection/:id/training — add +1/+2/+3 OVR training bonus (max +3 total)
- GET /collection now includes chemistry_style, position_override, training_bonus,
  effective_overall and effective_position fields per owned card
- Migration 0007 adds three columns to owned_cards with safe defaults
- 10 new integration tests — all 55 pass, clippy clean

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-25 17:02:44 -07:00

27 lines
725 B
Rust

use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct StatBoosts {
pub pace: i32,
pub shooting: i32,
pub passing: i32,
pub dribbling: i32,
pub defending: i32,
pub physical: i32,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ChemistryStyle {
pub id: String,
pub name: String,
pub description: String,
pub boosts: StatBoosts,
}
pub fn load_chemistry_styles(data_dir: &str) -> anyhow::Result<Vec<ChemistryStyle>> {
let path = format!("{data_dir}/chemistry_styles.json");
let raw = std::fs::read_to_string(&path)
.map_err(|e| anyhow::anyhow!("failed to read {path}: {e}"))?;
Ok(serde_json::from_str(&raw)?)
}