-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathHuman.java
70 lines (54 loc) · 1.33 KB
/
Human.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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
package human;
public class Human {
int strength, stealth, intelligence, health;
public Human() {
super();
this.strength = 3;
this.stealth = 3;
this.intelligence = 3;
this.health = 100;
}
public Human(int strength, int stealth, int intelligence, int health) {
super();
this.strength = strength;
this.stealth = stealth;
this.intelligence = intelligence;
this.health = health;
}
public int getStrength() {
return strength;
}
public void setStrength(int strength) {
this.strength = strength;
}
public int getStealth() {
return stealth;
}
public void setStealth(int stealth) {
this.stealth = stealth;
}
public int getIntelligence() {
return intelligence;
}
public void setIntelligence(int intelligence) {
this.intelligence = intelligence;
}
public int getHealth() {
return health;
}
public void setHealth(int health) {
this.health = health;
}
@Override
public String toString() {
return "Human [Strength()=" + getStrength() + ", Stealth()=" + getStealth() + ", Intelligence()="
+ getIntelligence() + ", Health()=" + getHealth() + "]";
}
public Human attack(Human enemy) {
int damage = enemy.getHealth();
damage -= getStrength();
enemy.setHealth(damage);
System.out.println(" " + enemy.getHealth() + "% ~ ataque a un " + enemy.getClass().getSimpleName());
return this;
}
}