Implementa rotazione regolamentare con cambio palla
- La formazione ruota solo quando si conquista il servizio (cambio palla) - Aggiunge array servizioPrecedente per tracciare i cambi palla - Fix decPunt per annullare correttamente la rotazione - Fix resetta per pulire lo stack dei servizi precedenti
This commit is contained in:
@@ -24,6 +24,7 @@ export default {
|
|||||||
home: ["1", "2", "3", "4", "5", "6"],
|
home: ["1", "2", "3", "4", "5", "6"],
|
||||||
guest: ["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"],
|
guest: ["1", "2", "3", "4", "5", "6"],
|
||||||
}
|
}
|
||||||
this.sp.striscia = { home: [0], guest: [0] }
|
this.sp.striscia = { home: [0], guest: [0] }
|
||||||
|
this.sp.servizioPrecedente = []
|
||||||
},
|
},
|
||||||
incSet(team) {
|
incSet(team) {
|
||||||
if (this.sp.set[team] == 2) {
|
if (this.sp.set[team] == 2) {
|
||||||
@@ -89,8 +91,16 @@ export default {
|
|||||||
this.sp.striscia.guest.push(this.sp.punt.guest)
|
this.sp.striscia.guest.push(this.sp.punt.guest)
|
||||||
this.sp.striscia.home.push(' ')
|
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.form[team].push(this.sp.form[team].shift());
|
||||||
|
}
|
||||||
|
|
||||||
|
this.sp.servHome = (team == "home");
|
||||||
},
|
},
|
||||||
checkVittoria() {
|
checkVittoria() {
|
||||||
const puntHome = this.sp.punt.home;
|
const puntHome = this.sp.punt.home;
|
||||||
@@ -117,14 +127,22 @@ export default {
|
|||||||
if (this.sp.striscia.home.length > 1) {
|
if (this.sp.striscia.home.length > 1) {
|
||||||
var tmpHome = this.sp.striscia.home.pop()
|
var tmpHome = this.sp.striscia.home.pop()
|
||||||
var tmpGuest = this.sp.striscia.guest.pop()
|
var tmpGuest = this.sp.striscia.guest.pop()
|
||||||
|
var cambioPalla = this.sp.servizioPrecedente.pop() // Recupera se c'era stato cambio palla
|
||||||
|
|
||||||
if (tmpHome == ' ') {
|
if (tmpHome == ' ') {
|
||||||
this.sp.punt.guest--
|
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());
|
this.sp.form.guest.unshift(this.sp.form.guest.pop());
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
this.sp.punt.home--
|
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());
|
this.sp.form.home.unshift(this.sp.form.home.pop());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
// decPunt(team) {
|
// decPunt(team) {
|
||||||
// // decrementa il punteggio se è > 0.
|
// // decrementa il punteggio se è > 0.
|
||||||
|
|||||||
Reference in New Issue
Block a user