LETS START A RIOT OOO A RIOT
This commit is contained in:
parent
72f7a2e529
commit
a491769914
22 changed files with 234 additions and 0 deletions
33
Code/Steiner/simpleGame/src/Character.java
Normal file
33
Code/Steiner/simpleGame/src/Character.java
Normal 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
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue