import { GameConfig } from "../../types";

export const caboConfig: GameConfig = {
  imagePath: "/games-assets/cabo-logo.webp",
  bannerPath: "/games-assets/cabo-banner.webp",
  rulesUrl: "/games-assets/cabo-rules.pdf",
  id: "cabo",
  name: "Cabo",
  minPlayers: 2,
  maxPlayers: 5,
  scoreType: "negative",
  targetScore: 100,
  targetScoreCondition: "reaches",
  description:
    "Trouvez la licorne. La partie se termine si on atteint ou dépasse 100 points. Tomber pile sur 100 fait redescendre le score à 50 (une fois par joueur).",
  icon: "Ghost",
  colors: {
    primary: "#6e1d5a", // Violet foncé tiré de la boite Cabo
  },
  calculatePlayerTotal: (rounds, playerId) => {
    let total = 0;
    let ruleUsed = false;
    for (const round of rounds) {
      const pScore = round.scores.find((s) => s.playerId === playerId);
      total += pScore?.score || 0;
      if (total === 100 && !ruleUsed) {
        total = 50;
        ruleUsed = true;
      }
    }
    return total;
  },
  options: [
    {
      id: "kamikaze",
      label: "Règle Kamikaze (2 cartes 13 + 2 cartes 12)",
      type: "boolean",
      defaultValue: true,
    },
  ],
};
