Add configurable napola rule with instant win on a full denari sweep
This commit is contained in:
@@ -113,6 +113,45 @@ pub fn summary_rows(summary: HandSummary) -> View {
|
||||
summary.award.primiera.clone(),
|
||||
"+1",
|
||||
),
|
||||
// Napola (only when the rule is enabled for this match)
|
||||
match summary.napola {
|
||||
None => view! {},
|
||||
Some(napola) => {
|
||||
let n = match summary.award.napola.as_deref() {
|
||||
Some("A") => napola.a,
|
||||
Some("B") => napola.b,
|
||||
_ => 0,
|
||||
};
|
||||
let text = match (&summary.award.napola, n) {
|
||||
(Some(t), 10) => format!(
|
||||
"Team {t} swept the whole denari suit — napola! Instant match win"
|
||||
),
|
||||
(Some(t), n) => format!(
|
||||
"Team {t} captured {n} consecutive denari from the ace"
|
||||
),
|
||||
(None, _) => "No napola this hand".to_string(),
|
||||
};
|
||||
let chip = match &summary.award.napola {
|
||||
Some(t) => format!("Team {t} +{n}"),
|
||||
None => "tie".to_string(),
|
||||
};
|
||||
let cls = match summary.award.napola.as_deref() {
|
||||
Some("A") => "score-row team-a",
|
||||
Some("B") => "score-row team-b",
|
||||
_ => "score-row tie",
|
||||
};
|
||||
view! {
|
||||
div(class=cls) {
|
||||
div(class="score-icon") { (card_img("01D".to_string(), "score-mini")) }
|
||||
div(class="score-body") {
|
||||
div(class="score-title") { "Napola" }
|
||||
div(class="score-text") { (text) }
|
||||
}
|
||||
div(class="score-points") { (chip) }
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
// Scope
|
||||
{
|
||||
let a = summary.scope.a;
|
||||
|
||||
Reference in New Issue
Block a user