Commit e354de28 authored by Guillaume Dewisme's avatar Guillaume Dewisme

supp dupli

parent 405cef0f
package org.example; package org.example;
import org.example.SpecialAbility;
import org.example.DoubleAttack;
import org.example.Character;
import java.io.FileWriter; import java.io.FileWriter;
import java.io.IOException; import java.io.IOException;
...@@ -38,42 +41,6 @@ public class BeatThemAllGame { ...@@ -38,42 +41,6 @@ public class BeatThemAllGame {
} }
} }
// on pourra la modifier par la suite si des éléments ne conviennent pas
public static abstract class Character {
protected String name;
protected int maxHP;
protected int currentHP;
protected int attackPower;
protected int defense;
protected SpecialAbility specialAbility;
public Character(String name, int maxHP, int attackPower, int defense) {
this.name = name;
this.maxHP = maxHP;
this.currentHP = maxHP;
this.attackPower = attackPower;
this.defense = defense;
}
public boolean isAlive() {
return currentHP > 0;
}
public void takeDamage(int damage) {
int actualDamage = Math.max(damage - defense, 0);
currentHP = Math.max(currentHP - actualDamage, 0);
System.out.println(name + " subit " + actualDamage + " dégâts. (PV restants : " + currentHP + ")");
}
public abstract void attack(Character target);
public void useSpecialAbility(Character target) {
if (specialAbility != null) {
specialAbility.activate(this, target);
}
}
}
// Classe pour le héros // Classe pour le héros
public static class Hero extends Character { public static class Hero extends Character {
private boolean specialUsed = false; private boolean specialUsed = false;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment