Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,18 @@
<artifactId>junit-jupiter-engine</artifactId>
<version>5.11.2</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>5.11.4</version>
<scope>test</scope>
</dependency>
</dependencies>


Expand Down
39 changes: 38 additions & 1 deletion src/main/java/Character.java
Original file line number Diff line number Diff line change
@@ -1,14 +1,51 @@
class Character implements Combatant {
abstract class Character implements Combatant {


// 🗒️ PROPIEDADES
protected String name;
protected int health;
protected Status status;
// le falta el status

// 🏗️ CONSTRUCTOR
protected Character(String name, int health) {
this.name = name;
this.health = health;
this.status = Status.REGULAR;
// el status inicial debe ser siempre REGULAR
}

@Override
public void receiveDamage(int damage) {
this.health -= damage;
if (this.health <= 0){
this.health = 0;
this.status = Status.DEAD;
}
}

@Override
public boolean isAlive() {
return this.health > 0;

}

@Override
public int getCurrentHealth() {
return this.health;
}

@Override
public String getName() {
return this.name;
}

@Override
public String getStatus() {

if (this.health <= 0) {

}
return this.status.toString();
}
}
3 changes: 3 additions & 0 deletions src/main/java/Combatant.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,7 @@ public interface Combatant {
int getCurrentHealth(); // Obtener la salud actual
String getName(); // Obtener el nombre
String getStatus(); // Obtener el estado (Vivo, Muerto, etc.)



}