Clement COLMERAUER commited on 2024-10-21 11:14:24
Showing 25 changed files, with 41 additions and 41 deletions.
| ... | ... |
@@ -41,7 +41,7 @@ |
| 41 | 41 |
</td> |
| 42 | 42 |
<td> |
| 43 | 43 |
<div class="infoBox" id="duration"> |
| 44 |
-<div class="counter">0.203s</div> |
|
| 44 |
+<div class="counter">0.164s</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.203s</td> |
|
| 79 |
+<td class="success">0.164s</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:07:21</p> |
|
| 92 |
+<a href="http://www.gradle.org">Gradle 8.8</a> at 21 oct. 2024, 11:13:10</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.018s</div> |
|
| 44 |
+<div class="counter">0.017s</div> |
|
| 45 | 45 |
<p>duration</p> |
| 46 | 46 |
</div> |
| 47 | 47 |
</td> |
| ... | ... |
@@ -90,7 +90,7 @@ |
| 90 | 90 |
<tr> |
| 91 | 91 |
<td class="success">Main</td> |
| 92 | 92 |
<td class="success">testMain()</td> |
| 93 |
-<td class="success">0.001s</td> |
|
| 93 |
+<td class="success">0.002s</td> |
|
| 94 | 94 |
<td class="success">passed</td> |
| 95 | 95 |
</tr> |
| 96 | 96 |
<tr> |
| ... | ... |
@@ -102,13 +102,13 @@ |
| 102 | 102 |
<tr> |
| 103 | 103 |
<td class="success">Natural Tests</td> |
| 104 | 104 |
<td class="success">testNatural()</td> |
| 105 |
-<td class="success">0.002s</td> |
|
| 105 |
+<td class="success">0.001s</td> |
|
| 106 | 106 |
<td class="success">passed</td> |
| 107 | 107 |
</tr> |
| 108 | 108 |
<tr> |
| 109 | 109 |
<td class="success">Constructor Player</td> |
| 110 | 110 |
<td class="success">testPlayerConstructor()</td> |
| 111 |
-<td class="success">0.001s</td> |
|
| 111 |
+<td class="success">0s</td> |
|
| 112 | 112 |
<td class="success">passed</td> |
| 113 | 113 |
</tr> |
| 114 | 114 |
<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:07:21</p> |
|
| 148 |
+<a href="http://www.gradle.org">Gradle 8.8</a> at 21 oct. 2024, 11:13:10</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.221s</div> |
|
| 41 |
+<div class="counter">0.181s</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.221s</td> |
|
| 88 |
+<td>0.181s</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.203s</td> |
|
| 115 |
+<td>0.164s</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.018s</td> |
|
| 125 |
+<td>0.017s</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:07:21</p> |
|
| 139 |
+<a href="http://www.gradle.org">Gradle 8.8</a> at 21 oct. 2024, 11:13:10</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.221s</div> |
|
| 43 |
+<div class="counter">0.181s</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.203s</td> |
|
| 86 |
+<td>0.164s</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.018s</td> |
|
| 96 |
+<td>0.017s</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:07:21</p> |
|
| 109 |
+<a href="http://www.gradle.org">Gradle 8.8</a> at 21 oct. 2024, 11:13:10</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:07:21" hostname="a206pc27L.local.isima.fr" time="0.203"> |
|
| 2 |
+<testsuite name="re.forestier.edu.GlobalTest" tests="1" skipped="0" failures="0" errors="0" timestamp="2024-10-21T09:13:10" hostname="a206pc27L.local.isima.fr" time="0.164"> |
|
| 3 | 3 |
<properties/> |
| 4 |
- <testcase name="testAffichageBase()" classname="re.forestier.edu.GlobalTest" time="0.203"/> |
|
| 4 |
+ <testcase name="testAffichageBase()" classname="re.forestier.edu.GlobalTest" time="0.164"/> |
|
| 5 | 5 |
<system-out><![CDATA[]]></system-out> |
| 6 | 6 |
<system-err><![CDATA[]]></system-err> |
| 7 | 7 |
</testsuite> |
| ... | ... |
@@ -1,15 +1,15 @@ |
| 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:07:21" hostname="a206pc27L.local.isima.fr" time="0.021"> |
|
| 2 |
+<testsuite name="re.forestier.edu.UnitTests" tests="10" skipped="0" failures="0" errors="0" timestamp="2024-10-21T09:13:10" hostname="a206pc27L.local.isima.fr" time="0.023"> |
|
| 3 | 3 |
<properties/> |
| 4 | 4 |
<testcase name="Affichage" classname="re.forestier.edu.UnitTests" time="0.006"/> |
| 5 |
- <testcase name="Main" classname="re.forestier.edu.UnitTests" time="0.001"/> |
|
| 5 |
+ <testcase name="Main" classname="re.forestier.edu.UnitTests" time="0.002"/> |
|
| 6 | 6 |
<testcase name="removeMoney" classname="re.forestier.edu.UnitTests" time="0.004"/> |
| 7 | 7 |
<testcase name="ex & lvl" classname="re.forestier.edu.UnitTests" time="0.001"/> |
| 8 | 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.001"/> |
| 10 | 10 |
<testcase name="majDeFinDeTour" classname="re.forestier.edu.UnitTests" time="0.001"/> |
| 11 |
- <testcase name="Constructor Player" classname="re.forestier.edu.UnitTests" time="0.001"/> |
|
| 12 |
- <testcase name="Natural Tests" classname="re.forestier.edu.UnitTests" time="0.002"/> |
|
| 11 |
+ <testcase name="Constructor Player" classname="re.forestier.edu.UnitTests" time="0.0"/> |
|
| 12 |
+ <testcase name="Natural Tests" classname="re.forestier.edu.UnitTests" time="0.001"/> |
|
| 13 | 13 |
<testcase name="Sample test" classname="re.forestier.edu.UnitTests" time="0.0"/> |
| 14 | 14 |
<system-out><![CDATA[]]></system-out> |
| 15 | 15 |
<system-err><![CDATA[]]></system-err> |
| ... | ... |
@@ -17,7 +17,7 @@ public class Player {
|
| 17 | 17 |
private Float __real_money__; |
| 18 | 18 |
|
| 19 | 19 |
private Natural level; |
| 20 |
- private int healthpoints; |
|
| 20 |
+ private Natural maxHealthPoint; |
|
| 21 | 21 |
private int currenthealthpoints; |
| 22 | 22 |
private int xp; |
| 23 | 23 |
|
| ... | ... |
@@ -60,14 +60,14 @@ public class Player {
|
| 60 | 60 |
return this.level.toInt(); |
| 61 | 61 |
} |
| 62 | 62 |
|
| 63 |
- public int getHealthPoints() |
|
| 63 |
+ public int getMaxHealthPoints() |
|
| 64 | 64 |
{
|
| 65 |
- return this.healthpoints; |
|
| 65 |
+ return this.maxHealthPoint.toInt(); |
|
| 66 | 66 |
} |
| 67 | 67 |
|
| 68 |
- public void setHealthPoints(int hp) |
|
| 68 |
+ public void setMaxHealthPoints(int hp) |
|
| 69 | 69 |
{
|
| 70 |
- this.healthpoints = hp; |
|
| 70 |
+ this.maxHealthPoint = Natural.valueOf(hp); |
|
| 71 | 71 |
} |
| 72 | 72 |
|
| 73 | 73 |
public int getCurrentHealthPoints() |
| ... | ... |
@@ -105,7 +105,7 @@ public class UpdatePlayer {
|
| 105 | 105 |
return; |
| 106 | 106 |
} |
| 107 | 107 |
|
| 108 |
- if(player.getCurrentHealthPoints() < player.getHealthPoints()/2) {
|
|
| 108 |
+ if(player.getCurrentHealthPoints() < player.getMaxHealthPoints()/2) {
|
|
| 109 | 109 |
if(!player.getAvatarClass().equals("ADVENTURER")) {
|
| 110 | 110 |
if(player.getAvatarClass().equals("DWARF")) {
|
| 111 | 111 |
if(player.inventory.contains("Holy Elixir")) {
|
| ... | ... |
@@ -129,8 +129,8 @@ public class UpdatePlayer {
|
| 129 | 129 |
} |
| 130 | 130 |
} else |
| 131 | 131 |
{
|
| 132 |
- if(player.getCurrentHealthPoints() >= player.getHealthPoints()) {
|
|
| 133 |
- player.setCurrentHealthPoints(player.getHealthPoints()); |
|
| 132 |
+ if(player.getCurrentHealthPoints() >= player.getMaxHealthPoints()) {
|
|
| 133 |
+ player.setCurrentHealthPoints(player.getMaxHealthPoints()); |
|
| 134 | 134 |
return; |
| 135 | 135 |
} |
| 136 | 136 |
} |
| ... | ... |
@@ -124,7 +124,7 @@ public class UnitTests {
|
| 124 | 124 |
UpdatePlayer.majFinDeTour(p); |
| 125 | 125 |
assertEquals("Le joueur est KO !", outContent.toString().trim());
|
| 126 | 126 |
p.setCurrentHealthPoints(1); |
| 127 |
- p.setHealthPoints(10); |
|
| 127 |
+ p.setMaxHealthPoints(10); |
|
| 128 | 128 |
UpdatePlayer.majFinDeTour(p); |
| 129 | 129 |
assertThat(p.getCurrentHealthPoints(),is(2)); |
| 130 | 130 |
p.addXp(100); |
| ... | ... |
@@ -134,17 +134,17 @@ public class UnitTests {
|
| 134 | 134 |
assertThat(p.getCurrentHealthPoints(),is(9)); |
| 135 | 135 |
p.setCurrentHealthPoints(11); |
| 136 | 136 |
UpdatePlayer.majFinDeTour(p); |
| 137 |
- assertThat(p.getCurrentHealthPoints(),is(p.getHealthPoints())); |
|
| 137 |
+ assertThat(p.getCurrentHealthPoints(),is(p.getMaxHealthPoints())); |
|
| 138 | 138 |
|
| 139 | 139 |
p = new Player("Florian", "Grognak le barbare", "DWARF", 100, new ArrayList<>());
|
| 140 | 140 |
p.setCurrentHealthPoints(1); |
| 141 |
- p.setHealthPoints(10); |
|
| 141 |
+ p.setMaxHealthPoints(10); |
|
| 142 | 142 |
UpdatePlayer.majFinDeTour(p); |
| 143 | 143 |
assertThat(p.getCurrentHealthPoints(),is(2)); |
| 144 | 144 |
|
| 145 | 145 |
p = new Player("Florian", "Grognak le barbare", "DWARF", 100, new ArrayList<>());
|
| 146 | 146 |
p.setCurrentHealthPoints(5); |
| 147 |
- p.setHealthPoints(10); |
|
| 147 |
+ p.setMaxHealthPoints(10); |
|
| 148 | 148 |
UpdatePlayer.majFinDeTour(p); |
| 149 | 149 |
assertThat(p.getCurrentHealthPoints(),is(5)); |
| 150 | 150 |
|
| ... | ... |
@@ -152,19 +152,19 @@ public class UnitTests {
|
| 152 | 152 |
inv.add("Holy Elixir");
|
| 153 | 153 |
p = new Player("Florian", "Grognak le barbare", "DWARF", 100, inv);
|
| 154 | 154 |
p.setCurrentHealthPoints(1); |
| 155 |
- p.setHealthPoints(10); |
|
| 155 |
+ p.setMaxHealthPoints(10); |
|
| 156 | 156 |
UpdatePlayer.majFinDeTour(p); |
| 157 | 157 |
assertThat(p.getCurrentHealthPoints(),is(3)); |
| 158 | 158 |
|
| 159 | 159 |
p = new Player("Florian", "Grognak le barbare", "ARCHER", 100, new ArrayList<>());
|
| 160 | 160 |
p.setCurrentHealthPoints(1); |
| 161 |
- p.setHealthPoints(10); |
|
| 161 |
+ p.setMaxHealthPoints(10); |
|
| 162 | 162 |
UpdatePlayer.majFinDeTour(p); |
| 163 | 163 |
assertThat(p.getCurrentHealthPoints(),is(2)); |
| 164 | 164 |
|
| 165 | 165 |
p = new Player("Florian", "Grognak le barbare", "ADVENTURER", 100, new ArrayList<>());
|
| 166 | 166 |
p.setCurrentHealthPoints(1); |
| 167 |
- p.setHealthPoints(10); |
|
| 167 |
+ p.setMaxHealthPoints(10); |
|
| 168 | 168 |
p.addXp(28); |
| 169 | 169 |
UpdatePlayer.majFinDeTour(p); |
| 170 | 170 |
assertThat(p.getCurrentHealthPoints(),is(3)); |
| ... | ... |
@@ -172,17 +172,17 @@ public class UnitTests {
|
| 172 | 172 |
inv.add("Magic Bow");
|
| 173 | 173 |
p = new Player("Florian", "Grognak le barbare", "ARCHER", 100, inv);
|
| 174 | 174 |
p.setCurrentHealthPoints(1); |
| 175 |
- p.setHealthPoints(10); |
|
| 175 |
+ p.setMaxHealthPoints(10); |
|
| 176 | 176 |
UpdatePlayer.majFinDeTour(p); |
| 177 | 177 |
assertThat(p.getCurrentHealthPoints(),is(1)); |
| 178 | 178 |
p.setCurrentHealthPoints(16); |
| 179 |
- p.setHealthPoints(40); |
|
| 179 |
+ p.setMaxHealthPoints(40); |
|
| 180 | 180 |
UpdatePlayer.majFinDeTour(p); |
| 181 | 181 |
assertThat(p.getCurrentHealthPoints(),is(17 + 17/8-1)); |
| 182 | 182 |
|
| 183 | 183 |
p = new Player("Florian", "Grognak le barbare", "ADVENTURER", 100, new ArrayList<>());
|
| 184 | 184 |
p.setCurrentHealthPoints(20); |
| 185 |
- p.setHealthPoints(40); |
|
| 185 |
+ p.setMaxHealthPoints(40); |
|
| 186 | 186 |
UpdatePlayer.majFinDeTour(p); |
| 187 | 187 |
assertEquals(p.getCurrentHealthPoints(),20); |
| 188 | 188 |
} |
| 189 | 189 |