-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathEnemy.java
41 lines (33 loc) · 904 Bytes
/
Enemy.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
// Classe que representa um inimigo
class Enemy {
private String name;
private int health;
private int attackDamage;
public Enemy(String name, int health, int attackDamage) {
this.name = name;
this.health = health;
this.attackDamage = attackDamage;
}
public String getName() {
return this.name;
}
public int getHealth() {
return this.health;
}
public int getAttackDamage() {
return this.attackDamage;
}
public int attack() {
// Implemente a lógica do ataque do inimigo
return this.attackDamage;
}
public void reduceHealth(int damage) {
this.health -= damage;
}
public void increaseHealth(int damage) {
this.health += damage;
}
public boolean isDefeated() {
return this.health <= 0;
}
}