forked from c0g4ih4l4n/AI_OAQ
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTrongTai.java
786 lines (698 loc) · 24.8 KB
/
TrongTai.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
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
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package testSQuares2;
import java.awt.Color;
import java.awt.Graphics2D;
import java.awt.Image;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
*
* @author VPC
*/
class TrongTai {
private final int DUNG = 0;
private final int DI = 1;
private final int AN = 2;
private final int BOC = 3;
private final int KIEM_TRA = 4;
private final int DOI = 5;
private final int NUMBER_IMAGE = 25;
private Game game;
public Player player;
public Board board;
private Image hand;
int danInHand;
private int x, y; //Tọa độ bàn tay
Step buocDi;
int selected;
int direction;
int state;
boolean eating = false;
int count = 0; // bien dem de ve ban tay
int countAn = 0;
int thaoTacAn = 0;
int thaoTacLay = 0; // dem lay quan
boolean thaoTacTha = false;
// Short Link
House[] houseShortLink;
Villa q0ShortLink;
Villa q6ShortLink;
Player p1ShortLink;
Player p2ShortLink;
public TrongTai(Game game) {
this.game = game;
x = game.board.START_X;
y = game.board.START_Y;
danInHand = 0;
houseShortLink = game.board.houses;
q0ShortLink = game.board.q0;
q6ShortLink = game.board.q6;
p1ShortLink = game.p1;
p2ShortLink = game.p2;
this.state = DOI;
this.count = 0;
this.thaoTacLay = 0;
}
/**
* Di Tung buoc
*/
public void handle(Step buocDi) {
// neu trang thai dang tu doi
// duoc goi
// den luot rai quan
if (this.state == DOI) {
this.selected = buocDi.chose;
this.direction = buocDi.direc;
setToaDoLayQuan();
if (thaoTacLayQuan()) {
return;
}
this.thaoTacLay = 0;
this.danInHand = layQuan(this.selected);
chuyenNhaKe(this.direction);
System.out.println("So Dan : " + this.danInHand + " Selected : " + this.selected + " direction : " + this.direction);
this.state = DI;
this.thaoTacTha = false;
return;
}
if (this.count < NUMBER_IMAGE && this.state != KIEM_TRA && !(this.state == DI && this.thaoTacTha) && this.thaoTacAn != 1 && this.thaoTacAn != 2) {
tangToaDo();
return;
}
this.count = 0;
try {
Thread.sleep(0);
} catch (Exception e) {
}
// kiem tra trang thai cua trong tai
switch (this.state) {
case DUNG:
this.state = DOI;
this.eating = false;
game.history.add(new GameState(game, buocDi));
System.out.println(game.history.stack.size());
setTurnToken(buocDi);
if (!checkContinueGame(board)) {
this.game.turnToken = 0;
tinhDiem();
return;
}
if (checkBoardPlayer(buocDi)) {
themDan(buocDi);
}
resetBuocDi();
break;
case DI:
if (this.thaoTacTha) {
this.thaoTacTha = false;
return;
}
this.thaoTacTha = true;
rai1Quan();
chuyenNhaKe(direction);
System.out.println("So Dan : " + this.danInHand + " Selected : " + this.selected + " direction : " + this.direction);
setToaDo();
break;
case AN:
if (this.countAn != 1) {
this.countAn ++;
return;
}
if (this.thaoTacAn != 2) {
this.thaoTacAn++;
return;
}
this.thaoTacAn = 0;
this.countAn = 0;
An(buocDi, this.selected);
chuyenNhaKe(direction);
this.eating = true;
this.state = KIEM_TRA;
break;
case BOC:
break;
case KIEM_TRA:
int result = checkFinalHouse(this.selected, direction);
System.out.println("Check : Selected : " + this.selected + " Direction : " + this.direction);
System.out.println("Ket Qua Kiem Tra : " + result);
switch (result) {
// Truong hop di tiep
case 1:
if (this.eating) {
this.state = DUNG;
break;
}
setToaDoLayQuan();
if (thaoTacLayQuan()) {
return;
}
this.thaoTacLay = 0;
this.danInHand = layQuan(this.selected);
chuyenNhaKe(direction);
this.state = DI;
this.thaoTacTha = false;
break;
// Truong hop An
case 2:
chuyenNhaKe(direction);
this.eating = true;
this.state = AN;
break;
// Truong hop dung
case 0:
this.state = DUNG;
break;
default:
break;
}
break;
}
return;
}
public boolean thaoTacLayQuan() {
if (this.thaoTacLay < 3) {
try {
Thread.sleep(0);
} catch (Exception e) {
}
this.thaoTacLay++;
return true;
}
return false;
}
// public boolean thaoTacThaQuan() {
// if (this.thaoTacTha < 2) {
// try {
// Thread.sleep(300);
// } catch (InterruptedException ex) {
// Logger.getLogger(TrongTai.class.getName()).log(Level.SEVERE, null, ex);
// }
// this.thaoTacTha++;
// return true;
// }
// return false;
// }
/**
* Rai 1 Quan Neu So Quan Trong tay het Chuyen trang thai ban ve kiem tra
*/
public void rai1Quan() {
this.danInHand--;
if (this.selected != 6 && this.selected != 0) {
houseShortLink[this.selected].tangDanSo();
} else if (this.selected == 0) {
q0ShortLink.tangDanSo();
} else {
q6ShortLink.tangDanSo();
}
if (this.danInHand == 0) {
this.state = KIEM_TRA;
}
}
/**
* Thuc hien buoc di va an quan
*
* @param buocDi (chose, direc)
*/
public void oldhandle(Step buocDi) {
int soDan;
this.selected = buocDi.chose;
// boolean flagAn = false;
// Kiem tra so dan trong nha cuoi de di tiep
while (true) {
soDan = layQuan(this.selected);
System.out.println("So Dan : " + soDan + " selected : " + selected);
chuyenNhaKe(buocDi.direc);
raiQuan(soDan, buocDi.direc);
System.out.println("Result Check : " + checkFinalHouse(this.selected, buocDi.direc));
if (checkFinalHouse(this.selected, buocDi.direc) != 1) {
break;
}
}
// TH An Dan
while (checkFinalHouse(this.selected, buocDi.direc) == 2) {
chuyenNhaKe(buocDi.direc);
An(buocDi, this.selected);
// Chuyen den o tiep theo de xet
chuyenNhaKe(buocDi.direc);
System.out.println("Selected : " + this.selected);
}
// set token de choi tiep
setTurnToken(buocDi);
System.out.println("Continue Check : " + checkContinueGame(board));
if (!checkContinueGame(board)) {
this.game.turnToken = 0;
}
// Trong Truong hop khong du quan de rai khi het dan trong cac o
// Score < 5
// thi game over
if (this.game.turnToken != 0 && checkBoardPlayer(buocDi)) {
themDan(buocDi);
}
resetBuocDi();
}
/**
* Lay quan va set so quan la 0
*
* @param selected => O Dang xet
* @return soQuan nhan duoc
*/
public int layQuan(int selected) {
int danSo = houseShortLink[selected].getDanSo();
houseShortLink[selected].setDanSo(0);
// repaint();
return danSo;
}
public void chuyenNhaKe(int direction) {
this.selected = tangNhaKe(direction, this.selected);
}
public int tangNhaKe(int direction, int current) {
if (direction == 1) {
if (current == 11) {
current = 0;
} else {
current++;
}
} else if (current == 0) {
current = 11;
} else {
current--;
}
return current;
}
/**
* Lay So Dan va dai den khi het
*
* @param soDan => So Quan de rai
* @param direction => Huong rai quan
* @param selected => O Duoc chon
* @return O Cuoi Cung khi het quan (so quan con lai de rai = 0)
*/
public void raiQuan(int soDan, int direction) {
for (int i = soDan; i > 0; i--) {
// neu vao quan 0
if (this.selected == 0) {
q0ShortLink.tangDanSo();
} // neu vao quan 6
else if (this.selected == 6) {
q6ShortLink.tangDanSo();
} // neu khong vao quan
else {
houseShortLink[this.selected].tangDanSo();
}
chuyenNhaKe(direction);
}
}
/**
* Kiem tra o ket thuc
*
* @param selected
* @param direction => Huong di de xet theo truong hop
* @return 0 => Dung (2 O Trong Hoac Quan) 1 => Choi Tiep (O Co chua soi va
* khong la quan) 2 => An Dan (O Trong sau do la 1 o dan co quan) 3 => An
* Quan
*/
public int checkFinalHouse(int current, int direction) {
int checked;
// vao o quan
if (current == 0 || current == 6) {
if (this.eating) {
checked = tangNhaKe(direction, current);
if (checkEmpty(checked)) {
int checked_next = tangNhaKe(direction, checked);
if (checkEmpty(checked_next)) {
return 0;
}
return 2;
}
return 0;
}
return 0;
}
// Khong Gap O Quan
// So Dan khac 0 Choi Tiep
if (houseShortLink[current].getDanSo() != 0) {
return 1;
}
// So dan o do = 0
// So dan o tiep theo
checked = tangNhaKe(direction, current);
// = 0 Dung
// != 0 An
if (checkEmpty(checked)) {
return 0;
} else {
if (checked == 0 && q0ShortLink.coQuan && q0ShortLink.getDanSo() < 5) {
return 0;
}
if (checked == 6 && q6ShortLink.coQuan && q6ShortLink.getDanSo() < 5) {
return 0;
}
return 2;
}
}
/**
* Kiem tra nha trong hay khong
*
* @param current
* @return
*/
public boolean checkEmpty(int current) {
if (current == 0) {
if (q0ShortLink.coQuan || (q0ShortLink.getDanSo() != 0)) {
return false;
}
return true;
}
if (current == 6) {
if (q6ShortLink.coQuan || (q6ShortLink.getDanSo() != 0)) {
return false;
}
return true;
}
if (houseShortLink[current].getDanSo() != 0) {
return false;
}
return true;
}
public void An(Step buocDi, int current) {
if (current == 0 || current == 6) {
AnQuan(buocDi, current);
} else {
AnDan(buocDi, current);
}
}
/**
* An Dan
*
* @param selected
* @param direction => Chieu an quan
* @return
*/
public void AnDan(Step buocDi, int current) {
if (isPlayer1(buocDi)) {
int soQuanAn = layQuan(current);
p1ShortLink.currentScore += soQuanAn;
p1ShortLink.soDanAnDuoc += soQuanAn;
} else {
int soQuanAn = layQuan(current);
p2ShortLink.currentScore += soQuanAn;
p2ShortLink.soDanAnDuoc += soQuanAn;
}
}
public void AnQuan(Step buocDi, int current) {
// Quan 0
if (current == 0) {
if (isPlayer1(buocDi)) {
p1ShortLink.currentScore = p1ShortLink.currentScore + q0ShortLink.getDanSo();
p1ShortLink.soDanAnDuoc += q0ShortLink.getDanSo();
q0ShortLink.setDanSo(0);
if (q0ShortLink.coQuan) {
q0ShortLink.coQuan = false;
p1ShortLink.currentScore += 10;
p1ShortLink.soQuanAnDuoc++;
}
} else {
p2ShortLink.currentScore = p2ShortLink.currentScore + q0ShortLink.getDanSo();
p2ShortLink.soDanAnDuoc += q0ShortLink.getDanSo();
q0ShortLink.setDanSo(0);
if (q0ShortLink.coQuan) {
q0ShortLink.coQuan = false;
p2ShortLink.currentScore += 10;
p2ShortLink.soQuanAnDuoc++;
}
}
} // Quan 6
else if (isPlayer1(buocDi)) {
p1ShortLink.currentScore = p1ShortLink.currentScore + q6ShortLink.getDanSo();
p1ShortLink.soDanAnDuoc += q6ShortLink.getDanSo();
q6ShortLink.setDanSo(0);
if (q6ShortLink.coQuan) {
q6ShortLink.coQuan = false;
p1ShortLink.currentScore += 10;
p1ShortLink.soQuanAnDuoc++;
}
} else {
p2ShortLink.currentScore = p2ShortLink.currentScore + q6ShortLink.getDanSo();
p2ShortLink.soDanAnDuoc += q6ShortLink.getDanSo();
q6ShortLink.setDanSo(0);
if (q6ShortLink.coQuan) {
q6ShortLink.coQuan = false;
p2ShortLink.currentScore += 10;
p2ShortLink.soQuanAnDuoc++;
}
}
}
public boolean checkContinueGame(Board board) {
if (checkEmpty(0) && checkEmpty(6)) {
return false;
}
return true;
}
public void tinhDiem() {
for (int i = 1; i <= 5; i++) {
p1ShortLink.soDanAnDuoc += houseShortLink[i].getDanSo();
}
for (int i = 7; i <= 11; i++) {
p2ShortLink.soDanAnDuoc += houseShortLink[i].getDanSo();
}
}
public boolean isPlayer1(Step buocDi) {
if (buocDi.chose > 6) {
return true;
}
return false;
}
/**
* Turn tiep theo la player 1
*
* @param token
* @return true neu dung false neu sai
*/
public boolean nextTurnIsPlayer1(Step buocDi) {
return buocDi.chose < 6;
}
// set token cho luot tiep theo
public void setTurnToken(Step buocDi) {
if (isPlayer1(buocDi)) {
game.turnToken = 5;
} else {
game.turnToken = 6;
}
}
// kiem tra
// neu so quan tren ban het thi them
public boolean checkBoardPlayer(Step buocDi) {
boolean allEmpty = true;
if (nextTurnIsPlayer1(buocDi)) {
for (int i = 7; i <= 11; i++) {
if (houseShortLink[i].getDanSo() != 0) {
allEmpty = false;
}
}
} else {
for (int i = 1; i < 6; i++) {
if (houseShortLink[i].getDanSo() != 0) {
allEmpty = false;
}
}
}
return allEmpty;
}
/**
* Them 1 dan vao moi o cua player co luot tiep
*
* @param token
*/
public void themDan(Step buocDi) {
if (nextTurnIsPlayer1(buocDi)) {
// Tru diem cua player
if (p1ShortLink.soDanAnDuoc < 5 && p1ShortLink.soQuanAnDuoc == 0) {
this.game.turnToken = 0;
return;
} else if (p2ShortLink.soDanAnDuoc < 5 && p1ShortLink.soQuanAnDuoc != 0 && p1ShortLink.soDanAnDuoc < 5) {
this.game.turnToken = 0;
return;
} else if (p1ShortLink.soQuanAnDuoc > 0 && p1ShortLink.soDanAnDuoc < 5) {
p1ShortLink.soQuanAnDuoc--;
p2ShortLink.soQuanAnDuoc++;
p2ShortLink.soDanAnDuoc -= 5;
// p2ShortLink.currentScore += 5;
p1ShortLink.soDanAnDuoc += 5;
// p1ShortLink.currentScore -= 5;
}
p1ShortLink.soDanAnDuoc -= 5;
for (int i = 7; i <= 11; i++) {
houseShortLink[i].setDanSo(1);
}
} else {
// Tru diem cua player
if (p2ShortLink.soDanAnDuoc < 5 && p2ShortLink.soQuanAnDuoc == 0) {
this.game.turnToken = 0;
return;
} else if (p1ShortLink.soDanAnDuoc < 5 && p2ShortLink.soDanAnDuoc < 5 && p2ShortLink.soQuanAnDuoc != 0) {
this.game.turnToken = 0;
return;
} else if (p2ShortLink.soDanAnDuoc < 5 && p2ShortLink.soQuanAnDuoc != 0) {
p2ShortLink.soQuanAnDuoc--;
p1ShortLink.soQuanAnDuoc++;
p1ShortLink.soDanAnDuoc -= 5;
// p1ShortLink.currentScore += 5;
p2ShortLink.soDanAnDuoc += 5;
// p2ShortLink.currentScore -= 5;
}
p2ShortLink.soDanAnDuoc -= 5;
for (int i = 1; i <= 5; i++) {
houseShortLink[i].setDanSo(1);
}
}
}
public void resetBuocDi() {
p1ShortLink.resetBuocDi();
p2ShortLink.resetBuocDi();
}
public void setToaDo() {
if (this.direction == 1) {
if (this.selected < 6 && this.selected != 0) {
this.x = game.board.START_X + (this.selected - 2) * 100;
this.y = game.board.START_Y;
} else if (this.selected > 6) {
this.x = game.board.START_X + (11 - this.selected + 1) * 100;
this.y = game.board.START_Y + 102;
} else if (this.selected == 0) {
this.x = game.board.START_X;
this.y = game.board.START_Y + 102;
// this.x = game.board.START_X - 100;
// this.y = game.board.START_Y + 50;
} else {
this.x = game.board.START_X + 400;
this.y = game.board.START_Y;
// this.x = game.board.START_X + 503;
// this.y = game.board.START_Y + 50;
}
} else if (this.selected < 6 && this.selected != 0) {
this.x = game.board.START_X + this.selected * 100;
this.y = game.board.START_Y;
} else if (this.selected > 6) {
this.x = game.board.START_X + (11 - this.selected - 1) * 100;
this.y = game.board.START_Y + 102;
} else if (this.selected == 0) {
this.x = game.board.START_X;
this.y = game.board.START_Y;
// this.x = game.board.START_X - 100;
// this.y = game.board.START_Y + 50;
} else {
this.x = game.board.START_X + 400;
this.y = game.board.START_Y + 102;
// this.x = game.board.START_X + 503;
// this.y = game.board.START_Y + 50;
}
}
public void setToaDoLayQuan() {
setToaDo();
if (this.direction == 1) {
if (this.selected < 6) {
this.x += 100;
} else {
this.x -= 100;
}
} else if (this.selected > 6) {
this.x += 100;
} else {
this.x -= 100;
}
}
public void tangToaDo() {
if (this.direction == -1) {
this.count++;
if (this.selected > 6) {
this.x += 4;
} else if (this.selected < 6 && this.selected != 0) {
this.x -= 4;
} else if (this.selected == 0 && !this.eating) {
this.y += 4;
this.x = game.board.START_X - (int) Math.sqrt(100 * 100 - Math.pow((this.y - game.board.START_Y - 102), 2));
} else if (!this.eating && this.selected == 6) {
this.y -= 4;
this.x = game.board.START_X + 400 + (int) Math.sqrt(100 * 100 - Math.pow((this.y - game.board.START_Y), 2));
} else if (this.selected == 0) {
if (this.countAn == 0) {
this.x -= 4;
} else {
this.y += 4;
this.x = game.board.START_X - (int) Math.sqrt(100 * 100 - Math.pow((this.y - game.board.START_Y - 102), 2));
}
} else if (this.selected == 6) {
if (this.countAn == 0) {
this.x += 4;
} else {
this.y -= 4;
this.x = game.board.START_X + 400 + (int) Math.sqrt(100 * 100 - Math.pow((this.y - game.board.START_Y), 2));
}
}
} else {
this.count++;
if (this.selected > 6) {
this.x -= 4;
} else if (this.selected < 6 && this.selected != 0) {
this.x += 4;
} else if (this.selected == 0 && !this.eating) {
this.y -= 4;
this.x = game.board.START_X - (int) Math.sqrt(100 * 100 - Math.pow((this.y - game.board.START_Y), 2));
} else if (!this.eating && this.selected == 6) {
this.y += 4;
this.x = game.board.START_X + 400 + (int) Math.sqrt(100 * 100 - Math.pow((this.y - game.board.START_Y - 102), 2));
} else if (this.selected == 0) {
if (this.countAn == 0) {
this.x -= 4;
} else {
this.y -= 4;
this.x = game.board.START_X - (int) Math.sqrt(100 * 100 - Math.pow((this.y - game.board.START_Y), 2));
}
} else if (this.selected == 6) {
if (this.countAn == 0) {
this.x += 4;
} else {
this.y += 4;
this.x = game.board.START_X + 400 + (int) Math.sqrt(100 * 100 - Math.pow((this.y - game.board.START_Y - 102), 2));
}
}
}
}
public void paint(Graphics2D g2d) {
if (this.state == DOI) {
if (this.thaoTacLay == 1) {
g2d.drawImage(Game.voSoi, this.x, this.y - 50, null);
} else if (this.thaoTacLay == 2) {
g2d.drawImage(Game.choTayXuong, this.x, this.y - 50, null);
}
} else if (this.state == DI) {
if (this.thaoTacTha) {
g2d.drawImage(Game.voSoi, this.x, this.y - 50, null);
} else {
g2d.drawImage(Game.namTay, this.x, this.y - 50, null);
g2d.setColor(Color.yellow);
g2d.drawString(String.valueOf(danInHand), this.x + 43, this.y - 50 + 38);
}
} else if (this.state == KIEM_TRA) {
if (this.thaoTacLay == 1) {
g2d.drawImage(Game.voSoi, this.x, this.y - 50, null);
} else if (this.thaoTacLay == 2) {
g2d.drawImage(Game.choTayXuong, this.x, this.y - 50, null);
}
} else if (this.state == AN) {
if (this.countAn == 1 && this.thaoTacAn != 0) {
if (this.thaoTacAn == 1) {
g2d.drawImage(Game.voSoi1, this.x, this.y - 50, null);
} else if (this.thaoTacAn == 2) {
g2d.drawImage(Game.voSoi2, this.x, this.y - 40, null);
}
} else {
g2d.drawImage(Game.tayKhong, this.x, this.y - 50, null);
}
}
}
}