wip-formazione #3

Merged
davide merged 3 commits from wip-formazione into master 2026-01-28 12:00:46 +01:00
Showing only changes of commit bbe0862241 - Show all commits

View File

@@ -24,6 +24,7 @@ export default {
home: ["1", "2", "3", "4", "5", "6"],
guest: ["1", "2", "3", "4", "5", "6"],
},
servizioPrecedente: [], // Stack per tracciare i cambi palla
},
}
},
@@ -66,6 +67,7 @@ export default {
guest: ["1", "2", "3", "4", "5", "6"],
}
this.sp.striscia = { home: [0], guest: [0] }
this.sp.servizioPrecedente = []
},
incSet(team) {
if (this.sp.set[team] == 2) {
@@ -89,8 +91,16 @@ export default {
this.sp.striscia.guest.push(this.sp.punt.guest)
this.sp.striscia.home.push(' ')
}
this.sp.servHome = (team == "home");
// Ruota la formazione solo se c'è cambio palla (conquista del servizio)
const cambioPalla = (team == "home" && !this.sp.servHome) || (team == "guest" && this.sp.servHome);
this.sp.servizioPrecedente.push(cambioPalla); // Salva se c'è stato cambio palla
if (cambioPalla) {
this.sp.form[team].push(this.sp.form[team].shift());
}
this.sp.servHome = (team == "home");
},
checkVittoria() {
const puntHome = this.sp.punt.home;
@@ -117,14 +127,22 @@ export default {
if (this.sp.striscia.home.length > 1) {
var tmpHome = this.sp.striscia.home.pop()
var tmpGuest = this.sp.striscia.guest.pop()
var cambioPalla = this.sp.servizioPrecedente.pop() // Recupera se c'era stato cambio palla
if (tmpHome == ' ') {
this.sp.punt.guest--
// Ruota indietro solo se c'era stato un cambio palla
if (cambioPalla) {
this.sp.form.guest.unshift(this.sp.form.guest.pop());
}
} else {
this.sp.punt.home--
// Ruota indietro solo se c'era stato un cambio palla
if (cambioPalla) {
this.sp.form.home.unshift(this.sp.form.home.pop());
}
}
}
},
// decPunt(team) {
// // decrementa il punteggio se è > 0.