From 839057e70a2373eca489665b19fc5a91d098bd12 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Antoine=20F=C3=A9lix?= <felixantoine67@yahoo.fr>
Date: Wed, 1 Apr 2020 19:06:29 +0200
Subject: [PATCH] =?UTF-8?q?Mise=20en=20place=20des=20variations=20des=20co?=
 =?UTF-8?q?mp=C3=A9tences=20et=20des=20efforts=20de=20chaque=20=C3=A9l?=
 =?UTF-8?q?=C3=A8ve.?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../psychorientation/InterfaceClasse.cs       | 13 ++---
 psychorientation/psychorientation/Note.cs     |  8 +--
 psychorientation/psychorientation/eleve.cs    | 50 ++++++++++++++++++-
 .../psychorientation/psychorientation.csproj  |  3 ++
 4 files changed, 62 insertions(+), 12 deletions(-)

diff --git a/psychorientation/psychorientation/InterfaceClasse.cs b/psychorientation/psychorientation/InterfaceClasse.cs
index f8469b2..069dcc1 100644
--- a/psychorientation/psychorientation/InterfaceClasse.cs
+++ b/psychorientation/psychorientation/InterfaceClasse.cs
@@ -21,7 +21,6 @@ namespace psychorientation
             InitializeComponent();
         }
 
-
         private void Form1_Load(object sender, EventArgs e)
         {
             lbl_date.Text = libelle.Mois(moisActuel % 12) + " " + libelle.Niveau(anneeActuelle);
@@ -53,11 +52,13 @@ namespace psychorientation
                     break;
                 case 42: // Fin de la 3ème année : Debut Juillet.
                     // Fin de la partie.
-                    Message m_fin = new Message(-1, "Vous avez fini la phase bêta de ce jeu !\n" + 
-                                                "Bravo à vous et n'hésitez pas à essayer à nouveau pour " + 
-                                                "améliorer votre compréhension du monde extérieur.", 
-                                                "Félicitations", 
-                                                TypeMessage.INFORMATION
+                    Message m_fin = new Message(
+                        -1, 
+                        "Vous avez fini la phase bêta de ce jeu !\n" + 
+                        "Bravo à vous et n'hésitez pas à essayer à nouveau pour " + 
+                        "améliorer votre compréhension du monde extérieur.", 
+                        "Félicitations", 
+                        TypeMessage.INFORMATION
                     );
                     m_fin.ShowDialog();
                     Close();
diff --git a/psychorientation/psychorientation/Note.cs b/psychorientation/psychorientation/Note.cs
index f8363bb..9b9b8a6 100644
--- a/psychorientation/psychorientation/Note.cs
+++ b/psychorientation/psychorientation/Note.cs
@@ -21,22 +21,22 @@ namespace psychorientation
             this.effort = effort;
         }
 
-        public string getNom()
+        public string GetNom()
         {
             return this.nom;
         }
 
-        public double getNote()
+        public double GetNote()
         {
             return this.note;
         }
 
-        public double getCompetence()
+        public double GetCompetence()
         {
             return this.competence;
         }
 
-        public double getEffort()
+        public double GetEffort()
         {
             return this.effort;
         }
diff --git a/psychorientation/psychorientation/eleve.cs b/psychorientation/psychorientation/eleve.cs
index 11b0034..3623a7e 100644
--- a/psychorientation/psychorientation/eleve.cs
+++ b/psychorientation/psychorientation/eleve.cs
@@ -104,14 +104,60 @@ namespace psychorientation
 
         public void Progression(double typeEducation)
         {
-            this.competence += (this.effort - typeEducation) / competence * 2;
-            this.effort += (this.effort - typeEducation) / competence * 2;
+            double t_competence = competence;
+            this.competence += (this.effort - typeEducation) * (1 - (competence * 0.1)) * (1.0 / 12);
+
+            if (competence < 0) { competence = 0; }
+            else if (competence > 10) { competence = 10; }
+
+            if (t_competence != typeEducation)
+                this.effort += Math.Min(Math.Max(((1 / Math.Abs(t_competence - typeEducation)) - (1.0 / 3)) * 3, -1), 1) * 0.5;
+            else
+                this.effort += 0.5;
+
+            if (effort < 0) { effort = 0; }
+            else if (effort > 10) { effort = 10; }
         }
 
         public void AjouterNote(string nom)
         {
             Note n = new Note(nom, CalculerNote(), this.competence, this.effort);
             this.listeNotes.Add(n);
+
+            double note = n.GetNote();
+            double note_convenable = 10 + (competence - 5);
+            if (effort > 5)
+            {
+                if (note > note_convenable)
+                {
+                    effort += 0.25;
+                }
+                else
+                {
+                    effort -= 0.5;
+                }
+            }
+            else
+            {
+                if (note > note_convenable)
+                {
+                    effort -= 0.25;
+                }
+                else
+                {
+                    if(competence > 5)
+                    {
+                        effort += 1;
+                    }
+                    else
+                    {
+                        effort -= 0.5;
+                    }
+                }
+            }
+
+            if (effort < 0) { effort = 0; }
+            else if (effort > 10) { effort = 10; }
         }
 
         private double CalculerNote()
diff --git a/psychorientation/psychorientation/psychorientation.csproj b/psychorientation/psychorientation/psychorientation.csproj
index 5719a11..3a279ee 100644
--- a/psychorientation/psychorientation/psychorientation.csproj
+++ b/psychorientation/psychorientation/psychorientation.csproj
@@ -125,5 +125,8 @@
   <ItemGroup>
     <None Include="Resources\sortir.png" />
   </ItemGroup>
+  <ItemGroup>
+    <None Include="Resources\grp.png" />
+  </ItemGroup>
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
 </Project>
\ No newline at end of file
-- 
GitLab