LETS START A RIOT OOO A RIOT

This commit is contained in:
Sage The DM 2024-11-27 15:00:54 +01:00
parent 72f7a2e529
commit a491769914
22 changed files with 234 additions and 0 deletions

View file

@ -0,0 +1,33 @@
public abstract class Character {
protected String name;
protected int health;
protected int attackPower;
public Character(String name, int health, int attackPower) {
this.name = name;
this.health = health;
this.attackPower = attackPower;
}
public void takeDamage(int damage) {
this.health -= damage;
}
public boolean isAlive() {
return this.health > 0;
}
public String getName() {
return name;
}
public int getHealth() {
return health;
}
public int getAttackPower() {
return attackPower;
}
public abstract void displayInfo(); // Abstract method to be implemented by subclasses
}