-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCharacter.java
More file actions
41 lines (30 loc) · 748 Bytes
/
Copy pathCharacter.java
File metadata and controls
41 lines (30 loc) · 748 Bytes
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
public abstract class Character{
protected int hp;
protected int strength;
protected int defense;
protected double attackrating;
protected boolean isAlive(){
if (hp <= 0){
return false;
}
return true;
}
protected int getDefense(){
return defense;
}
protected String getName(){
return "";
}
protected void lowerHP(int ssubtractThis){
hp = hp - ssubtractThis;
}
protected int attack(Character toAttack){
int damage = (int)(strength * attackrating) - toAttack.getDefense();
if (damage < 0){ damage = 0;}
toAttack.lowerHP(damage);
return damage;
}
protected abstract String about();
protected abstract void specialize();
protected abstract void normalize();
}