Skip to content

Commit

Permalink
boulot fini
Browse files Browse the repository at this point in the history
  • Loading branch information
chaucorn committed Sep 21, 2023
1 parent bd4c8fd commit c1c835e
Show file tree
Hide file tree
Showing 6 changed files with 85 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .classpath
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="output" path="bin"/>
</classpath>
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@

/bin/
17 changes: 17 additions & 0 deletions .project
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>LesGaulois</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
32 changes: 32 additions & 0 deletions src/personnages/Gaulois.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package personnages;

public class Gaulois {
private String nom;
private int force;
private int effetPotion = 1;
public Gaulois(String nom, int force) {
this.nom = nom;
this.force = force;
}
public String getNom() {
return nom;
}
public void parler(String texte) {
System.out.println(prendreParole() + "« " + texte + "»");
}
private String prendreParole() {
return "Le gaulois " + nom + " : ";
}
public void frapper(Romain romain) {
System.out.println(nom + " envoie un grand coup dans la mâchoire de " + romain.getNom());
romain.recevoirCoup(force / 3);
}
@Override
public String toString() {
return "Gaulois [nom=" + nom + ", force=" + force + ", effetPotion=" + effetPotion + "]";
}
public static void main(String[] args) {
//TODO créer un main permettant de tester la classe Gaulois

}
}
27 changes: 27 additions & 0 deletions src/personnages/Romain.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package personnages;

public class Romain {
private String nom;
private int force;
public Romain(String nom, int force) {
this.nom = nom;
this.force = force;
}
public String getNom() {
return nom;
}
public void parler(String texte) {
System.out.println(prendreParole() + "« " + texte + "»");
}
private String prendreParole() {
return "Le romain " + nom + " : ";
}
public void recevoirCoup(int forceCoup) {
force -= forceCoup;
if (force > 0) {
parler("Aïe");
} else {
parler("J'abandonne...");
}
}
}
2 changes: 2 additions & 0 deletions src/personnages/package-info.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
package personnages;

0 comments on commit c1c835e

Please sign in to comment.