Interface Job supprimée
Clement Colmerauer

Clement Colmerauer commited on 2024-12-13 09:25:59
Showing 23 changed files, with 46 additions and 11 deletions.

... ...
@@ -1,10 +0,0 @@
1
-package re.forestier.edu.rpg;
2
-
3
-import java.util.HashMap;
4
-
5
-public interface Job
6
-{
7
-    public static final int maxLevel = 5;
8
-    public String name = "";
9
-    public HashMap<Ability, Integer[]> abilityPerLevel = new HashMap<Ability,Integer[]>();
10
-}
11 0
\ No newline at end of file
... ...
@@ -4,7 +4,7 @@ import static java.util.Map.entry;
4 4
 import java.util.Map;  
5 5
 import java.util.HashMap; 
6 6
 
7
-public enum Jobs implements Job
7
+public enum Jobs   
8 8
 {
9 9
     ADVENTURER
10 10
     { 
... ...
@@ -0,0 +1,45 @@
1
+package re.forestier.edu.rpg;
2
+
3
+import java.util.HashMap;
4
+import java.util.Random;
5
+
6
+public class Manager {
7
+
8
+    public final static String[] objectList = {"Magic bow : Heal by 1/8th of your HP","Lookout Ring : Prevents surprise attacks","Scroll of Stupidity : INT-2 when applied to an enemy", "Draupnir : Increases XP gained by 100%", "Magic Charm : Magic +10 for 5 rounds", "Rune Staff of Curse : May burn your ennemies... Or yourself. Who knows?", "Combat Edge : Well, that's an edge", "Holy Elixir : Recover your HP"
9
+    };
10
+
11
+    // majFinDeTour met à jour les points de vie
12
+    public static void majFinDeTour(Player player) {
13
+        if(player.getCurrentHealthPoints() == 0) {
14
+            System.out.println("Le joueur est KO !");
15
+            return;
16
+        }
17
+
18
+        if(player.getCurrentHealthPoints() < player.getMaxHealthPoints()/2) {
19
+            switch(player.getAvatarClass())
20
+            {
21
+                case ADVENTURER :
22
+                    player.heal(2);
23
+                    if(player.getLevel() < 3) {
24
+                        player.hurt(1);
25
+                    }
26
+                    break;
27
+                case DWARF :
28
+                    player.heal(1);
29
+                    if(player.inventory.contains("Holy Elixir")) {
30
+                        player.heal(1);
31
+                    }
32
+                    break;
33
+                case ARCHER :
34
+                    player.heal(1);
35
+                    if(player.inventory.contains("Magic Bow")) {
36
+                        int potentialHeal = player.getCurrentHealthPoints()/8-1;
37
+                        player.heal(potentialHeal < 0 ? 0 : potentialHeal);
38
+                    }
39
+                    break;
40
+            }
41
+        } 
42
+    }
43
+
44
+
45
+}
0 46
\ No newline at end of file
1 47