simplification majFinDeTour
Clement COLMERAUER

Clement COLMERAUER commited on 2024-10-21 12:05:04
Showing 22 changed files, with 34 additions and 34 deletions.

... ...
@@ -41,7 +41,7 @@
41 41
 </td>
42 42
 <td>
43 43
 <div class="infoBox" id="duration">
44
-<div class="counter">0.175s</div>
44
+<div class="counter">0.178s</div>
45 45
 <p>duration</p>
46 46
 </div>
47 47
 </td>
... ...
@@ -76,7 +76,7 @@
76 76
 </thead>
77 77
 <tr>
78 78
 <td class="success">testAffichageBase()</td>
79
-<td class="success">0.175s</td>
79
+<td class="success">0.178s</td>
80 80
 <td class="success">passed</td>
81 81
 </tr>
82 82
 </table>
... ...
@@ -89,7 +89,7 @@
89 89
 <input id="line-wrapping-toggle" type="checkbox" autocomplete="off"/>
90 90
 </label>
91 91
 </div>Generated by 
92
-<a href="http://www.gradle.org">Gradle 8.8</a> at 21 oct. 2024, 11:58:46</p>
92
+<a href="http://www.gradle.org">Gradle 8.8</a> at 21 oct. 2024, 12:04:46</p>
93 93
 </div>
94 94
 </div>
95 95
 </body>
... ...
@@ -41,7 +41,7 @@
41 41
 </td>
42 42
 <td>
43 43
 <div class="infoBox" id="duration">
44
-<div class="counter">0.016s</div>
44
+<div class="counter">0.018s</div>
45 45
 <p>duration</p>
46 46
 </div>
47 47
 </td>
... ...
@@ -78,7 +78,7 @@
78 78
 <tr>
79 79
 <td class="success">addMoney</td>
80 80
 <td class="success">testAddMoney()</td>
81
-<td class="success">0s</td>
81
+<td class="success">0.001s</td>
82 82
 <td class="success">passed</td>
83 83
 </tr>
84 84
 <tr>
... ...
@@ -126,7 +126,7 @@
126 126
 <tr>
127 127
 <td class="success">ex &amp; lvl</td>
128 128
 <td class="success">testRetrieveLevel()</td>
129
-<td class="success">0.001s</td>
129
+<td class="success">0.002s</td>
130 130
 <td class="success">passed</td>
131 131
 </tr>
132 132
 <tr>
... ...
@@ -145,7 +145,7 @@
145 145
 <input id="line-wrapping-toggle" type="checkbox" autocomplete="off"/>
146 146
 </label>
147 147
 </div>Generated by 
148
-<a href="http://www.gradle.org">Gradle 8.8</a> at 21 oct. 2024, 11:58:46</p>
148
+<a href="http://www.gradle.org">Gradle 8.8</a> at 21 oct. 2024, 12:04:46</p>
149 149
 </div>
150 150
 </div>
151 151
 </body>
... ...
@@ -38,7 +38,7 @@
38 38
 </td>
39 39
 <td>
40 40
 <div class="infoBox" id="duration">
41
-<div class="counter">0.191s</div>
41
+<div class="counter">0.196s</div>
42 42
 <p>duration</p>
43 43
 </div>
44 44
 </td>
... ...
@@ -85,7 +85,7 @@
85 85
 <td>11</td>
86 86
 <td>0</td>
87 87
 <td>0</td>
88
-<td>0.191s</td>
88
+<td>0.196s</td>
89 89
 <td class="success">100%</td>
90 90
 </tr>
91 91
 </tbody>
... ...
@@ -112,7 +112,7 @@
112 112
 <td>1</td>
113 113
 <td>0</td>
114 114
 <td>0</td>
115
-<td>0.175s</td>
115
+<td>0.178s</td>
116 116
 <td class="success">100%</td>
117 117
 </tr>
118 118
 <tr>
... ...
@@ -122,7 +122,7 @@
122 122
 <td>10</td>
123 123
 <td>0</td>
124 124
 <td>0</td>
125
-<td>0.016s</td>
125
+<td>0.018s</td>
126 126
 <td class="success">100%</td>
127 127
 </tr>
128 128
 </tbody>
... ...
@@ -136,7 +136,7 @@
136 136
 <input id="line-wrapping-toggle" type="checkbox" autocomplete="off"/>
137 137
 </label>
138 138
 </div>Generated by 
139
-<a href="http://www.gradle.org">Gradle 8.8</a> at 21 oct. 2024, 11:58:46</p>
139
+<a href="http://www.gradle.org">Gradle 8.8</a> at 21 oct. 2024, 12:04:46</p>
140 140
 </div>
141 141
 </div>
142 142
 </body>
... ...
@@ -40,7 +40,7 @@
40 40
 </td>
41 41
 <td>
42 42
 <div class="infoBox" id="duration">
43
-<div class="counter">0.191s</div>
43
+<div class="counter">0.196s</div>
44 44
 <p>duration</p>
45 45
 </div>
46 46
 </td>
... ...
@@ -83,7 +83,7 @@
83 83
 <td>1</td>
84 84
 <td>0</td>
85 85
 <td>0</td>
86
-<td>0.175s</td>
86
+<td>0.178s</td>
87 87
 <td class="success">100%</td>
88 88
 </tr>
89 89
 <tr>
... ...
@@ -93,7 +93,7 @@
93 93
 <td>10</td>
94 94
 <td>0</td>
95 95
 <td>0</td>
96
-<td>0.016s</td>
96
+<td>0.018s</td>
97 97
 <td class="success">100%</td>
98 98
 </tr>
99 99
 </table>
... ...
@@ -106,7 +106,7 @@
106 106
 <input id="line-wrapping-toggle" type="checkbox" autocomplete="off"/>
107 107
 </label>
108 108
 </div>Generated by 
109
-<a href="http://www.gradle.org">Gradle 8.8</a> at 21 oct. 2024, 11:58:46</p>
109
+<a href="http://www.gradle.org">Gradle 8.8</a> at 21 oct. 2024, 12:04:46</p>
110 110
 </div>
111 111
 </div>
112 112
 </body>
... ...
@@ -1,7 +1,7 @@
1 1
 <?xml version="1.0" encoding="UTF-8"?>
2
-<testsuite name="re.forestier.edu.GlobalTest" tests="1" skipped="0" failures="0" errors="0" timestamp="2024-10-21T09:58:45" hostname="a206pc27L.local.isima.fr" time="0.175">
2
+<testsuite name="re.forestier.edu.GlobalTest" tests="1" skipped="0" failures="0" errors="0" timestamp="2024-10-21T10:04:46" hostname="a206pc27L.local.isima.fr" time="0.178">
3 3
   <properties/>
4
-  <testcase name="testAffichageBase()" classname="re.forestier.edu.GlobalTest" time="0.175"/>
4
+  <testcase name="testAffichageBase()" classname="re.forestier.edu.GlobalTest" time="0.178"/>
5 5
   <system-out><![CDATA[]]></system-out>
6 6
   <system-err><![CDATA[]]></system-err>
7 7
 </testsuite>
... ...
@@ -1,11 +1,11 @@
1 1
 <?xml version="1.0" encoding="UTF-8"?>
2
-<testsuite name="re.forestier.edu.UnitTests" tests="10" skipped="0" failures="0" errors="0" timestamp="2024-10-21T09:58:45" hostname="a206pc27L.local.isima.fr" time="0.023">
2
+<testsuite name="re.forestier.edu.UnitTests" tests="10" skipped="0" failures="0" errors="0" timestamp="2024-10-21T10:04:46" hostname="a206pc27L.local.isima.fr" time="0.024">
3 3
   <properties/>
4 4
   <testcase name="Affichage" classname="re.forestier.edu.UnitTests" time="0.006"/>
5 5
   <testcase name="Main" classname="re.forestier.edu.UnitTests" time="0.001"/>
6 6
   <testcase name="removeMoney" classname="re.forestier.edu.UnitTests" time="0.004"/>
7
-  <testcase name="ex &amp; lvl" classname="re.forestier.edu.UnitTests" time="0.001"/>
8
-  <testcase name="addMoney" classname="re.forestier.edu.UnitTests" time="0.0"/>
7
+  <testcase name="ex &amp; lvl" classname="re.forestier.edu.UnitTests" time="0.002"/>
8
+  <testcase name="addMoney" classname="re.forestier.edu.UnitTests" time="0.001"/>
9 9
   <testcase name="Construcor UpdatePlayer" classname="re.forestier.edu.UnitTests" time="0.0"/>
10 10
   <testcase name="majDeFinDeTour" classname="re.forestier.edu.UnitTests" time="0.001"/>
11 11
   <testcase name="Constructor Player" classname="re.forestier.edu.UnitTests" time="0.001"/>
... ...
@@ -106,28 +106,28 @@ public class UpdatePlayer {
106 106
         }
107 107
 
108 108
         if(player.getCurrentHealthPoints() < player.getMaxHealthPoints()/2) {
109
-            if(!player.getAvatarClass().equals("ADVENTURER")) {
110
-                if(player.getAvatarClass().equals("DWARF")) {
111
-                    if(player.inventory.contains("Holy Elixir")) {
112
-                        player.heal(1);
109
+            switch(player.getAvatarClass())
110
+            {
111
+                case "ADVENTURER" :
112
+                    player.heal(2);
113
+                    if(player.getLevel() < 3) {
114
+                        player.hurt(1);
113 115
                     }
116
+                    break;
117
+                case "DWARF" :
118
+                    player.heal(1);
119
+                    if(player.inventory.contains("Holy Elixir")) {
114 120
                         player.heal(1);
115 121
                     }
116
-
117
-
118
-                if(player.getAvatarClass().equals("ARCHER")) {
122
+                    break;
123
+                case "ARCHER" :
119 124
                     player.heal(1);
120 125
                     if(player.inventory.contains("Magic Bow")) {
121 126
                         //player.setCurrentHealthPoints(player.getCurrentHealthPoints()+player.getCurrentHealthPoints()/8-1);
122 127
                         int potentialHeal = player.getCurrentHealthPoints()/8-1;
123 128
                         player.heal(potentialHeal < 0 ? 0 : potentialHeal);
124 129
                     }
125
-                }
126
-            } else {
127
-                player.heal(2);
128
-                if(player.getLevel() < 3) {
129
-                    player.hurt(1);
130
-                }
130
+                    break;
131 131
             }
132 132
         } 
133 133
     }
134 134