-
Notifications
You must be signed in to change notification settings - Fork 0
/
pro.puml
297 lines (259 loc) · 6.45 KB
/
pro.puml
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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
@startuml
class Position{
private int x = -1;
private int y = -1;
public void setX(int x);
public void setY(int y);
public int getX();
public int getY();
}
class Creature{
# int MAX_HP;
# int currentHP;
# Camp camp;
# boolean alive;
# boolean lastTimeSent;
# Image image;
# Random random;
# Position position;
# Map map;
# String name;
# int attackValue;
# int defenseValue;
# int moveRate;
# LinkedList<Bullet> bullets;
# BulletGenerator<? extends Bullet> bulletGenerator;
+ void getHurt(int damage);
+ void setPosition(int x, int y);
+ void move();
+ void attack();
+ void moveTo();
+ Creature searchCorssEnemies();
+ ArrayList<Creature> searchSudokuFriends();
+ Creature searchStraightEnemy();
+ void run();
+ void heal(int blood);
+ String getSimpleName();
}
Creature --o Position
Creature --> Bullet
Creature --o BulletGenerator
class JusticeCreature{
# boolean isControlled;
# LinkedList<Direction> moveDirections;
# LinkedList<Direction> bulletDirection;
}
interface Controllable{
+ void setControlled(boolean controlled);
+ void controlMove();
+ void controlAttack();
+ void addMoveDirection(Direction direction);
+ void addAttackDirection(Direction direction);
+ void clearMoveDirection();
+ void clearAttackDirection();
}
JusticeCreature ..|> Controllable
JusticeCreature --|> Creature
class Huluwa{
- int rank;
+ String getSimpleName();
+ void resetState();
}
interface Curable{
+ void cure();
}
class GrandPa{
- LinkedList<Direction> moveDirections = new LinkedList<Direction>();
- LinkedList<Direction> bulletDirection = new LinkedList<>();
+ void move();
+ void attack();
+ void cure();
+ void addMoveDirection(Direction direction);
+ void clearMoveDirection();
+ void addBulletDirection(Direction direction);
+ void clearMoveBulletDirection();
}
class EvilCreature{
}
class Evil{
+ String getSimpleName();
+ void resetState();
}
class Scorpion{
+ String getSimpleName();
+ void resetState();
}
class Snake{
+ String getSimpleName();
+ void resetState();
}
EvilCreature --|> Creature
Snake -|> EvilCreature
Scorpion --|> EvilCreature
Evil --|> EvilCreature
Huluwa --|>JusticeCreature
GrandPa --|>JusticeCreature
GrandPa ..|> Curable
Snake ..|> Curable
class Bullet{
- double x;
- double y;
# Color color;
# transient int damage;
# transient Creature sender;
# transient Creature target;
+ double getX();
+ double getY();
+ Color getColor();
+ int getDamage();
+ void move();
+ boolean outOfMap();
+ void setColor(Color color);
+ Creature getTarget();
+ int getCountDown();
}
class StraightBullet{
- Direction direction;
+ StraightBullet();
+ void setDirection(Direction direction);
+ void move();
}
class TrackBullet{
- int countDown;
+ void move();
+ int getCountDown();
}
StraightBullet --|> Bullet
TrackBullet --|> Bullet
class BulletGenerator{
+ T getBullet();
}
BulletGenerator --> Bullet
class StraightBulletGenerator{
+ StraightBullet getBullet();
}
class TrackBulletGenerator{
+ TrackBullet getBullet();
}
class BulletController{
- LinkedList<Bullet> bullets;
- Map map;
- BattleState battleState;
+ void moveAll();
+ void run();
+ void clearBullets();
}
BulletController --> BattleState
BulletController --> Map
BulletController --o Bullet
StraightBulletGenerator --|> BulletGenerator
TrackBulletGenerator --|> BulletGenerator
class Map{
- Creature[][] grounds;
- int refreshRate;
- GraphicsContext gc;
- BattleState battleState;
- LinkedList<Bullet> bullets;
- Image deadImage;
- Image backGroundImage;
- ObjectOutputStream writer;
- ObjectInputStream reader;
- HashMap<String, Image> typeImageMap;
- Image evilWinImage;
- Image justiceWinImage;
- Image pauseImage;
- Timeline reviewTimeline;
- void initDictionary();
+ Creature getCreatureAt();
+ void setCreatureAt();
+ void removeCreatureAt();
+ boolean noCreatureAt();
+ void display(boolean needRecord);
+ void drawBoardLines();
+ boolean insideMap();
+ void clearMap();
+ void setWriter(ObjectOutputStream writer);
+ void startReview();
+ void setReader(ObjectInputStream reader);
+ void drawRecord(Record record);
- Record getNextRecord();
+ void displayPause();
}
Creature --> Map
Map --> Bullet
Map --> BattleState
class BattleState{
- boolean battleStarted = false;
- boolean paused = false;
- boolean reviewing = false;
- Camp winner = null;
+ void setPaused(boolean paused);
+ boolean gamePaused();
+ void setStarted(boolean started);
+ boolean isBattleStarted();
+ void setWinner(Camp winnner);
+ Camp getWinner();
+ void setReviewing(boolean isReviewing);
+ boolean isReviewing();
+ boolean isInFreeState();
}
class BattleController{
+ static Stage stage = null;
- ExecutorService pool;
- BorderPane pane;
- Map map;
- BattleState battleState;
- ArrayList<Huluwa> huluwas = new ArrayList<Huluwa>();
- GrandPa grandPa;
- ArrayList<Evil> evils = new ArrayList<>();
- Scorpion scorpion;
- Snake snake;
- LinkedList<Bullet> bullets = new LinkedList<>();
- BulletController bulletController;
- ObjectOutputStream writer;
- ObjectInputStream reader;
- Timeline timeline;
- void initialize();
- void initGrandPa();
- void initHuluwas();
+ void arrangeHuluwas();
- void transFormChangShe();
+ void startGame();
+ void gameOver();
+ void review();
+ void pauseGame();
+ void continueGame();
}
BattleController --o Creature
BattleController --o BattleState
BattleController --o Map
Map --> BattleState
class BulletRecord{
+ double x;
+ double y;
+ boolean isRed;
}
class CreatureRecord{
+ int x;
+ int y;
+ Camp camp;
+ int currentHP;
+ boolean alive;
+ String type;
}
class Record{
+ ArrayList<CreatureRecord> creatureRecords;
+ ArrayList<BulletRecord> bulletRecords;
}
class Formation{
- static FormationKind nextFormation = HEYI;
+ static void transFormToNextFormation();
+ static void clearPreFormation();
+ static void transformToXXX();
}
Record --o CreatureRecord
Record --o BulletRecord
Formation --> Evil
Formation --> Snake
Formation --> Scorpion
@enduml