Skip to content
Snippets Groups Projects
Commit 49cc8bd7 authored by Malori Alvarez's avatar Malori Alvarez
Browse files

TP 1 - 4

parent 5c6d103c
No related branches found
No related tags found
No related merge requests found
File added
File added
File added
File added
File added
File added
File added
File added
File added
File added
File added
File added
...@@ -4,18 +4,14 @@ public class WarriorCard { ...@@ -4,18 +4,14 @@ public class WarriorCard {
private int strength; private int strength;
private int agility; private int agility;
//** /** <b>Cartes de combats</b>*/
/* <b>Cartes de combats</b>
*/
public WarriorCard(String name,int strength,int agility){ public WarriorCard(String name,int strength,int agility){
this.name = name; this.name = name;
this.strength = strength; this.strength = strength;
this.agility = agility; this.agility = agility;
} }
//** /** Vérifie l'égalités*/
/* Vérifie l'égalité
*/
public boolean equals(Object objet){ public boolean equals(Object objet){
if(this==objet)return true; if(this==objet)return true;
if(objet==null)return false; if(objet==null)return false;
...@@ -30,27 +26,20 @@ public class WarriorCard { ...@@ -30,27 +26,20 @@ public class WarriorCard {
return true; return true;
} //equals de string; pas de de lui-même } //equals de string; pas de de lui-même
//** /** Compare la <b>force</b> de deux guerriers */
/* Compare la <b>force</b> de deux guerriers
*/
public int compareStrength(WarriorCard other){ public int compareStrength(WarriorCard other){
return this.strength-other.strength; return this.strength-other.strength;
} }
//** /** Compare l'<b>agilité</b> de deux guerriers */
/* Compare l'<b>agilité</b> de deux guerriers
*/
public int compareAgility(WarriorCard other){ public int compareAgility(WarriorCard other){
return this.agility-other.agility; return this.agility-other.agility;
} }
//** /** Renvoie les <b>stats</b> et le nom du guerrier*/
/* Renvoie les <b>stats</b> et le nom du guerrier
*/
public String toString(){ public String toString(){
return this.name+"[S="+this.strength+",A="+agility+"]."; return this.name+"[S="+this.strength+",A="+agility+"].";
} }
//5 error 8 warning, je pète ma bière, ma lubullule //5 error 8 warning, je pète ma bière, ma lubullule
} }
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment