|
|
|
@ -2,6 +2,7 @@ using CoreLibrary.Persistance;
|
|
|
|
|
using CoreLibrary.Joueurs;
|
|
|
|
|
using CoreLibrary.Regles;
|
|
|
|
|
using CoreLibrary.Statistiques;
|
|
|
|
|
using CoreLibrary.Core;
|
|
|
|
|
|
|
|
|
|
namespace CoreLibrary.Manageurs
|
|
|
|
|
{
|
|
|
|
@ -103,15 +104,29 @@ namespace CoreLibrary.Manageurs
|
|
|
|
|
partie.PartieDemanderJoueur += (sender, e) => Sauvegarder();
|
|
|
|
|
partie.PartieDebutPartie += (sender, e) => Sauvegarder();
|
|
|
|
|
partie.PartieDemanderJoueurJouer += (sender, e) => Sauvegarder();
|
|
|
|
|
|
|
|
|
|
partie.PartiePasserLaMain += (sender, e) =>
|
|
|
|
|
{
|
|
|
|
|
DemanderJoueurExistant(e.Joueur)?.IncrementerStatistique(partie.Regles, Statistique.CoupJoue);
|
|
|
|
|
Sauvegarder();
|
|
|
|
|
};
|
|
|
|
|
partie.PartiePasserLaMain += (sender, e) => Sauvegarder();
|
|
|
|
|
|
|
|
|
|
partie.PartiePartieTerminee += (sender, e) =>
|
|
|
|
|
{
|
|
|
|
|
foreach (string joueur in e.Gagnants.Concat(e.Perdants))
|
|
|
|
|
{
|
|
|
|
|
Joueur? j = DemanderJoueurExistant(joueur);
|
|
|
|
|
|
|
|
|
|
if (j == null)
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
double coupmoyen = j.Statistique(partie.Regles, Statistique.CoupMoyen);
|
|
|
|
|
|
|
|
|
|
double partiesJouees =
|
|
|
|
|
j.Statistique(partie.Regles, Statistique.PartieGagnee) +
|
|
|
|
|
j.Statistique(partie.Regles, Statistique.PartieEgalite) +
|
|
|
|
|
j.Statistique(partie.Regles, Statistique.PartiePerdue);
|
|
|
|
|
|
|
|
|
|
double difference = (-coupmoyen + e.Tour) / (partiesJouees + 1);
|
|
|
|
|
|
|
|
|
|
j.IncrementerStatistique(partie.Regles, Statistique.CoupMoyen, difference);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (e.Gagnants.Count == 1)
|
|
|
|
|
{
|
|
|
|
|
DemanderJoueurExistant(e.Gagnants[0])?.IncrementerStatistique(partie.Regles, Statistique.PartieGagnee);
|
|
|
|
|