-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMumi.java
More file actions
106 lines (92 loc) · 2.74 KB
/
Mumi.java
File metadata and controls
106 lines (92 loc) · 2.74 KB
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
import java.util.Objects;
abstract class Mumi {
protected int stamina,thirst,hungry;
protected String name;
protected int x,y,z;
final static void moor() {
Transport[] transports = Transport.values();
Transport transport = transports[(int) (Math.random() * 3)];
System.out.print(" Они вытащили " + transport + " на берег");
}
final void makeBuilding() {
Materials[] materials = Materials.values();
Materials materal = materials[(int) (Math.random() * 3)];
TypesOfBuildings[] apartments = TypesOfBuildings.values();
TypesOfBuildings apartment = apartments[(int) (Math.random() * 3)];
Place[] place = Place.values();
Place placec = place[(int) (Math.random() * 3)];
stamina -= 25;
thirst -= 35;
hungry-=19;
System.out.println(" и " + placec + " мигом сделали " + apartment + " из " + materal + ". ");
}
abstract void run();
public int getX(){
return this.x;
}
public String getName(){
return this.name;
}
public int getStamina(){
return this.stamina;
}
public int getHungry(){
return this.hungry;
}
public int getThirst(){
return this.thirst;
}
public int getY(){
return this.y;
}
public int getZ(){
return this.z;
}
abstract void specialMove();
final void bringItems() {
stamina -= 50;
hungry -= 35;
thirst -= 16;
System.out.println("перетаскивая вещи в укрытие.");
}
final void findWater() {
stamina -= 50;
hungry -= 5;
thirst -= 10;
System.out.print(" пытаясь найти воду.");
}
final void bringDocs() {
stamina-=14;
hungry-=10;
thirst-=13;
System.out.println(" перетаскивая важные документы.");
}
final void getRest() {
stamina += 200;
hungry += 100;
thirst += 80;
System.out.println(name + " устал(a), решил(a) отдохнуть.");
}
final void checkStamina(int stamina, int hungry, int thirst) {
if (stamina <= 0 || hungry <= 0 || thirst <= 0) {
getRest();
}
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Mumi mumi = (Mumi) o;
return Objects.equals(name, mumi.name);
}
@Override
public int hashCode() {
return Objects.hash(name);
}
@Override
public String toString() {
return "Mumi{" +
"name='" + name + '\'' +
'}';
}
}