/** * @author yanababs * * TODO To change the template for this generated type comment go to * Window - Preferences - Java - Code Style - Code Templates */ public class Fantassin implements Soldat { int pointsDeVie; public Fantassin(){ pointsDeVie = 100; } public int attaquer() { System.out.println("attaque "+DEFAULT_POINTS_ATTAQUE); return DEFAULT_POINTS_ATTAQUE; } public void défendre(int force) throws DeadWarriorException { int coup = force - DEFAULT_POINTS_DEFENSE; pointsDeVie -= (coup < 0) ? 0:coup; if(pointsDeVie < 0) throw new DeadWarriorException(); System.out.println("Défense "+pointsDeVie); } }