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

This commit is contained in:
2026-09-17 22:50:59 +00:00
parent aa1fecae43
commit 22ef689092
12 changed files with 250 additions and 5 deletions
+12 -1
View File
@@ -24,6 +24,7 @@ pub fn LobbyPage() -> View {
let code = create_signal(String::new());
let game_types = create_signal(fallback_game_types());
let selected_game = create_signal("scopone_scientifico".to_string());
let napola = create_signal(true);
spawn_local(async move {
match api::me().await {
@@ -47,8 +48,9 @@ pub fn LobbyPage() -> View {
let on_create = move |target: i32| {
let game_type = selected_game.get_clone();
let napola = napola.get();
spawn_local(async move {
match api::create_game(&game_type, target).await {
match api::create_game(&game_type, target, napola).await {
Ok(game) => navigate(&format!("/game/{}", game.id)),
Err(e) => error.set(Some(e)),
}
@@ -101,6 +103,15 @@ pub fn LobbyPage() -> View {
key=|g| g.id.clone(),
)
}
label(class="check", r#for="napola") {
input(id="napola", r#type="checkbox", bind:checked=napola)
" Napola"
}
p(class="hint") {
"A-2-3 of denari scores 3 points, plus 1 per extra "
"consecutive denari card; sweeping the whole suit "
"wins the match instantly."
}
p { "First team to reach the target score wins." }
div(class="target-buttons") {
button(class="button", on:click=move |_| on_create(11)) { "Target 11" }