Add configurable napola rule with instant win on a full denari sweep

This commit is contained in:
2026-09-18 09:18:17 +08:00
parent f7fa8e78e5
commit db7ba30d13
12 changed files with 250 additions and 5 deletions
+13
View File
@@ -2,6 +2,10 @@
use serde::Deserialize;
use std::collections::HashMap;
fn default_true() -> bool {
true
}
#[derive(Debug, Clone, Deserialize)]
#[allow(dead_code)]
pub struct User {
@@ -75,6 +79,8 @@ pub struct Award {
pub settebello: Option<String>,
#[serde(default)]
pub primiera: Option<String>,
#[serde(default)]
pub napola: Option<String>,
}
/// The scoring breakdown of one completed hand.
@@ -86,6 +92,10 @@ pub struct HandSummary {
pub settebello: TeamBools,
pub primiera: TeamCounts,
pub scope: TeamCounts,
/// Napola run lengths per team; absent when the rule is disabled (or
/// the summary predates the option).
#[serde(default)]
pub napola: Option<TeamCounts>,
pub award: Award,
#[serde(default)]
pub hand: i32,
@@ -104,6 +114,9 @@ pub struct GameView {
/// Which card game this match is (id from /api/game-types).
#[serde(default)]
pub game_type: String,
/// Whether the napola rule is scored in this match.
#[serde(default = "default_true")]
pub napola: bool,
pub phase: String,
#[serde(default)]
pub target_score: i32,