From 5c6d103c0072b3d3bc096ad0411ac52fb1fa5aa6 Mon Sep 17 00:00:00 2001
From: Malori ALVAREZ <malori.alvarez.etu@univ-lille.fr>
Date: Mon, 10 Mar 2025 11:23:24 +0100
Subject: [PATCH] TPQU02

---
 src/tpqu02/WarriorCard.java | 56 +++++++++++++++++++++++++++++++++++++
 1 file changed, 56 insertions(+)
 create mode 100644 src/tpqu02/WarriorCard.java

diff --git a/src/tpqu02/WarriorCard.java b/src/tpqu02/WarriorCard.java
new file mode 100644
index 0000000..dbcd718
--- /dev/null
+++ b/src/tpqu02/WarriorCard.java
@@ -0,0 +1,56 @@
+package tpqu02;
+public class WarriorCard { 
+    private String name; 
+    private int strength; 
+    private int agility;
+
+    //** 
+    /* <b>Cartes de combats</b>
+     */
+    public WarriorCard(String name,int strength,int agility){
+        this.name = name;
+        this.strength = strength;
+        this.agility = agility;
+    }
+
+        //** 
+    /* Vérifie l'égalité
+     */
+    public boolean equals(Object objet){
+        if(this==objet)return true;
+        if(objet==null)return false;
+
+        if(this.getClass()!=objet.getClass()){return false;}
+        //downcast pour adapter l'equals à Warrior Card
+        WarriorCard other=(WarriorCard) objet;
+
+        if(this.name==null){
+            if(other.name != null) return false;
+            }else if(!this.name.equals(other.name)) return false;
+        return true;
+    }                         //equals de string; pas de de lui-même
+
+    //** 
+    /* Compare la <b>force</b> de deux guerriers 
+     */
+    public int compareStrength(WarriorCard other){
+        return this.strength-other.strength; 
+    }
+ //** 
+    /* Compare l'<b>agilité</b> de deux guerriers 
+     */
+    public int compareAgility(WarriorCard other){
+        return this.agility-other.agility; 
+    }
+ //** 
+    /* Renvoie les <b>stats</b> et le nom du guerrier
+     */
+    public String toString(){
+        return this.name+"[S="+this.strength+",A="+agility+"].";
+    }
+
+    
+    
+    //5 error 8 warning, je pète ma bière, ma lubullule 
+}
+ 
\ No newline at end of file
-- 
GitLab