-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
2000 lines (1748 loc) · 85.2 KB
/
main.py
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
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
import math
import os.path
import shutil
import sys
import time
import imagehash
import numpy
import pyautogui
import win32gui
from PIL import Image, ImageGrab
import pytesseract
import cv2
import numpy as np
from numpy import average, dot, linalg
from matplotlib import pyplot as plt
# from python_imagesearch.imagesearch import imagesearch
import pyautogui as pg
from os import listdir
from os.path import isfile, isdir, join
from random import choice, sample
import timeit
import win32api
from imagehash import average_hash
from array import array
from enum import Enum
from itertools import combinations
import win32file
class GameStatue(Enum):
Fighting = 0
Victory = 1
Lost = 1
WinWithExp = 2
WinWithSLPBounds = 3
MissionSelect = 4
class StepType(Enum):
CONTINUE = 'continue'
BREAK = 'break'
STEPOVER = 'stepover'
class HealCards(Enum):
Berry = '3-2.JPG'
FrontHeal = '3-1.JPG'
DOHeal = '2-2.JPG'
TESSERACT_OCR = r'C:\\Program Files\\tesseract-ORC\\tesseract.exe'
pytesseract.pytesseract.tesseract_cmd = TESSERACT_OCR
# https://github.com/tesseract-ocr
AXIE_WINDOW_PROPERTY = {'left': 0, 'top': 0, 'right': 0, 'bottom': 0, 'width': 0, 'height': 0}
class GalleryLibrary(Enum):
AXIE_NORMAL_Icon = '.\\picture\\gallery\\axies\\status_library\\normal'
AXIE_FIRE_Icon = '.\\picture\\gallery\\axies\\status_library\\fire'
AXIE_DIE_Icon = '.\\picture\\gallery\\axies\\status_library\\die'
AXIE_HP_Icon = '.\\picture\\gallery\\axies\\hp_icon'
AXIE_Sequence = '.\\picture\\gallery\\axies\\sequence'
AXIE_RUNTIME_FULL = '.\\picture\\runtime\\axies\\full'
AXIE_RUNTIME_DEBUFF = '.\\picture\\runtime\\axies\\debuff'
Button_Energy_0_Icon = '.\\picture\\gallery\\button\\energy_0.JPG'
Button_Energy_1_Icon = '.\\picture\\gallery\\button\\energy_1.JPG'
Button_Victory_Icon = '.\\picture\\gallery\\button\\victory.JPG'
Button_Defeated_Icon = '.\\picture\\gallery\\button\\defeated_fight.JPG'
Button_Defeated_Result_Icon = '.\\picture\\gallery\\button\\defeated_result.JPG' # 這是在戰鬥結束後,會有三隻畫加一個defeated的過場動畫的畫面
Button_Start_Mission_Button = '.\\picture\\gallery\\button\\start.JPG'
Button_SLP_Bounds = '.\\picture\\gallery\\button\\bounds_1.JPG'
Button_EndTurn_Button = '.\\picture\\gallery\\button\\end_turn.JPG'
Button_Debuff_1_Icon = '.\\picture\\gallery\\button\\debuff_1.JPG'
Misson_Final_Icon = '.\\picture\\gallery\\mission\\final'
Monster_Runtime_HP = '.\\picture\\runtime\\monsters\\hp'
Cards_Library = '.\\picture\\gallery\\cards'
Temp_Origin = '.\\picture\\origin.JPG'
Temp_Image = '.\\picture\\image_temp.JPG'
Full_Image = '.\\picture\\1.png'
print(GalleryLibrary.AXIE_NORMAL_Icon.value)
print(GalleryLibrary.Cards_Library.value)
CARDS_LIBRARY_LIST = listdir(GalleryLibrary.Cards_Library.value)
AXIE_NORMAL_LIST = listdir(GalleryLibrary.AXIE_NORMAL_Icon.value)
MISSION_ID = 19
pyautogui.PAUSE = 1
MAX_WIN_COUNT = 5
# 1 4
# 0 3 6
# 2 5
# pve mode
AXIE_STATUS = ['normal', 'fire', 'die']
class AXIE_STATUS_Enum(Enum):
Normal = 'normal'
Fire = 'fire'
Die = 'die'
AXIES_FORMATION = [{'id': '1986033', 'position_id': 6, 'status': AXIE_STATUS_Enum.Normal, 'status_count': 0}, # fish
{'id': '6805632', 'position_id': 3, 'status': AXIE_STATUS_Enum.Normal, 'status_count': 0}, # pink
{'id': '7035133', 'position_id': 0, 'status': AXIE_STATUS_Enum.Normal, 'status_count': 0} # green
]
AXIES_CARDS_PIC_PREFIX = {'1986033': '0', '6805632': '1', '7035133': '2'}
# class AXIE_STATUS(Enum):
# NORMAL = 'normal'
# FIRE = 'fire'
# DIE = 'die'
class POSITION_RUEL(Enum):
SINGLE = 'single'
DOUBLE = 'double'
AXIE_RUNTIME_SNAPSHOP_LOCATION = [
{'id': "1986033", 'nickname': 'fish', 'left': -110, 'top': -200, 'right': 85, 'bottom': -15},
{'id': "6805632", 'nickname': 'pink', 'left': -110, 'top': -200, 'right': 85, 'bottom': -15},
{'id': "7035133", 'nickname': 'green', 'left': -110, 'top': -200, 'right': 85, 'bottom': -15},
{'id': "1980381", 'nickname': 'do', 'left': -110, 'top': -200, 'right': 85, 'bottom': -15}
]
AXIE_RUNTIME_DEBUFF_SNAPSHOP_LOCATION = [
{'id': "1986033", 'nickname': 'fish', 'left': -95, 'top': -220, 'right': 75, 'bottom': -130},
{'id': "6805632", 'nickname': 'pink', 'left': -95, 'top': -220, 'right': 75, 'bottom': -130},
{'id': "7035133", 'nickname': 'green', 'left': -95, 'top': -220, 'right': 75, 'bottom': -130}
]
# row is x , col is y
AXIES_POSITION_ID = [
{'id': 0, 'x': 711, 'y': 576, 'row': 0, 'col': 1, 'rule': POSITION_RUEL.DOUBLE},
{'id': 1, 'x': 600, 'y': 474, 'row': 1, 'col': 0, 'rule': POSITION_RUEL.DOUBLE},
{'id': 2, 'x': 600, 'y': 676, 'row': 1, 'col': 2, 'rule': POSITION_RUEL.SINGLE},
{'id': 3, 'x': 485, 'y': 576, 'row': 2, 'col': 1, 'rule': POSITION_RUEL.SINGLE},
{'id': 4, 'x': 377, 'y': 474, 'row': 3, 'col': 0, 'rule': POSITION_RUEL.SINGLE},
{'id': 5, 'x': 377, 'y': 676, 'row': 4, 'col': 2, 'rule': POSITION_RUEL.DOUBLE},
{'id': 6, 'x': 262, 'y': 576, 'row': 5, 'col': 1, 'rule': POSITION_RUEL.DOUBLE}
]
AXIE_PVP_SNAPSHOP = {'left': -90, 'top': -160, 'right': 75, 'bottom': -90}
AXIE_PVP_POSITION_ID = [
{'id': 0, 'x': 772, 'y': 496, 'row': 0, 'col': 1, 'rule': POSITION_RUEL.SINGLE},
{'id': 1, 'x': 867, 'y': 410, 'row': 1, 'col': 0, 'rule': POSITION_RUEL.DOUBLE},
{'id': 2, 'x': 867, 'y': 582, 'row': 1, 'col': 2, 'rule': POSITION_RUEL.DOUBLE},
{'id': 3, 'x': 962, 'y': 496, 'row': 2, 'col': 1, 'rule': POSITION_RUEL.SINGLE},
{'id': 4, 'x': 1057, 'y': 410, 'row': 3, 'col': 0, 'rule': POSITION_RUEL.DOUBLE},
{'id': 5, 'x': 1057, 'y': 582, 'row': 3, 'col': 2, 'rule': POSITION_RUEL.DOUBLE},
{'id': 6, 'x': 1152, 'y': 496, 'row': 4, 'col': 1, 'rule': POSITION_RUEL.SINGLE}
]
class AXIE_DEBUFF(Enum):
Nothing = 0
DISABLE_ONE_CARD = 1
AXIES_NICKNAME = {'1986033': 'Fish', '1980381': 'do', '6805632': 'Pink', '7035133': 'Green'}
AXIE_HEAL_RELATION = [{'id': "1986033", 'healby': '1985659', 'healcard': []},
{'id': "1980381", 'healby': '1980381', 'healcard': ['2-2.JPG']},
{'id': "6805632", 'healby': '1985659', 'healcard': []},
{'id': "7035133", 'healby': '1985659', 'healcard': ['7035133-2.JPG']}
]
MY_AXIES = [
{'id': "1986033", 'nickname': 'fish', 'health': 1315, 'speed': 136, 'skill': 88, 'morale': 80,
'x': 0, 'y': 0, 'debuff': [], 'healByWhichAxie': '1980381',
'cards': [{'name': '1986033-1.JPG', 'attack': 387, 'shield': 96, 'energy': 1, 'heal': 0,
'property': ['attack', 'shield'], 'other': '', 'comboed': False, 'debuff_seq': 3},
{'name': '1986033-2.JPG', 'attack': 161, 'shield': 258, 'energy': 1, 'heal': 0,
'property': ['attack', 'shield'], 'other': 'add 30% shield', 'comboed': False, 'debuff_seq': 0},
{'name': '1986033-3.JPG', 'attack': 354, 'shield': 64, 'energy': 1, 'heal': 0,
'property': ['attack', 'shield', 'speed'], 'other': '', 'comboed': False, 'debuff_seq': 1},
{'name': '1986033-4.JPG', 'attack': 354, 'shield': 96, 'energy': 1, 'heal': 0,
'property': ['attack', 'shield', 'speed'], 'other': '', 'comboed': True, 'debuff_seq': 2},
]},
{'id': "6805632", 'nickname': 'pink', 'health': 1393, 'speed': 91, 'skill': 64, 'morale': 8591,
'x': 0, 'y': 0, 'debuff': [], 'healByWhichAxie': '1985659',
'cards': [{'name': '6805632-1.JPG', 'attack': 241, 'shield': 161, 'energy': 1, 'heal': 0,
'nickname': 'chomp', 'property': ['attack', 'shield'], 'other': 'heal front', 'comboed': True,
'debuff_seq': 3, 'comboed_number': 2},
{'name': '6805632-2.JPG', 'attack': 96, 'shield': 0, 'energy': 0, 'heal': 0,
'nickname': 'mystic rush', 'property': ['attack'], 'other': 'heal front or itself', 'comboed': False,
'debuff_seq': 1},
{'name': '6805632-3.JPG', 'attack': 129, 'shield': 193, 'energy': 1, 'heal': 0,
'nickname': 'sticky goo', 'property': ['attack', 'shield'], 'other': '', 'comboed': False,
'debuff_seq': 0},
{'name': '6805632-4.JPG', 'attack': 322, 'shield': 96, 'energy': 1, 'heal': 0,
'nickname': 'allergic reaction', 'property': ['attack', 'shield'], 'other': '', 'comboed': False,
'debuff_seq': 2},
]},
{'id': "7035133", 'nickname': 'green', 'health': 1664, 'speed': 71, 'skill': 88, 'morale': 85,
'x': 0, 'y': 0, 'debuff': [], 'healByWhichAxie': '1985659',
'cards': [{'name': '7035133-1.JPG', 'attack': 96, 'shield': 96, 'energy': 1, 'heal': 0,
'nickname': 'vegetal bite', 'property': ['attack', 'shield'], 'other': 'heal front', 'comboed': True,
'debuff_seq': 1, 'comboed_number': 1},
{'name': '7035133-2.JPG', 'attack': 0, 'shield': 161, 'energy': 1, 'heal': 387,
'nickname': 'healing aroma', 'property': ['heal'], 'other': 'heal front or itself', 'comboed': False,
'debuff_seq': 2},
{'name': '7035133-3.JPG', 'attack': 145, 'shield': 258, 'energy': 1, 'heal': 0,
'nickname': 'agua stock', 'property': ['attack', 'shield'], 'other': '', 'comboed': False,
'debuff_seq': 0},
{'name': '7035133-4.JPG', 'attack': 225, 'shield': 129, 'energy': 1, 'heal': 0,
'nickname': 'carrot hammer', 'property': ['attack', 'shield'], 'other': '', 'comboed': False,
'debuff_seq': 3},
]},
{'id': "1980381", 'nickname': 'do', 'health': 1393, 'speed': 130, 'skill': 88, 'morale': 88,
'x': 0, 'y': 0, 'debuff': [], 'healByWhichAxie': '1980381',
'cards': [{'name': '2-1.JPG', 'attack': 338, 'shield': 96, 'energy': 1, 'heal': 0,
'property': ['attack', 'shield'], 'other': 'attack 120%', 'comboed': True, 'debuff_seq': 2},
{'name': '2-2.JPG', 'attack': 0, 'shield': 129, 'energy': 1, 'heal': 387,
'property': ['heal', 'shield'], 'other': '', 'comboed': False, 'debuff_seq': 3},
{'name': '2-3.JPG', 'attack': 161, 'shield': 322, 'energy': 1, 'heal': 0,
'property': ['attack', 'shield'], 'other': 'plant target plus', 'comboed': False, 'debuff_seq': 1},
{'name': '2-4.JPG', 'attack': 96, 'shield': 0, 'energy': 0, 'heal': 0,
'property': ['attack', 'get energy'], 'other': 'gain 1 energy', 'comboed': True, 'debuff_seq': 0},
]}
]
MONSTERS_POSITION_ID = [
{'id': 0, 'x': 772, 'y': 496, 'row': 0, 'col': 1, 'rule': POSITION_RUEL.SINGLE},
{'id': 1, 'x': 867, 'y': 410, 'row': 1, 'col': 0, 'rule': POSITION_RUEL.DOUBLE},
{'id': 2, 'x': 867, 'y': 582, 'row': 1, 'col': 2, 'rule': POSITION_RUEL.DOUBLE},
{'id': 3, 'x': 962, 'y': 496, 'row': 2, 'col': 1, 'rule': POSITION_RUEL.SINGLE},
{'id': 4, 'x': 1057, 'y': 410, 'row': 3, 'col': 0, 'rule': POSITION_RUEL.DOUBLE},
{'id': 5, 'x': 1057, 'y': 582, 'row': 3, 'col': 2, 'rule': POSITION_RUEL.DOUBLE},
{'id': 6, 'x': 1152, 'y': 496, 'row': 4, 'col': 1, 'rule': POSITION_RUEL.SINGLE}
]
MONSTER_HP_INFO = {'w': 52, 'h': 22}
POSITION_COORDINATES = [{'id': 0, 'idx_x': 0, 'idx_y': 0},
{'id': 1, 'idx_x': 1, 'idx_y': 0},
{'id': 2, 'idx_x': 1, 'idx_y': 1},
{'id': 3, 'idx_x': 2, 'idx_y': 0},
{'id': 4, 'idx_x': 3, 'idx_y': 0},
{'id': 5, 'idx_x': 3, 'idx_y': 1},
{'id': 6, 'idx_x': 4, 'idx_y': 0}]
MONSTER_MISSION_INFO = \
[{'mission_id': '20', 'mission_number': 3, 'x': 27, 'y': 118, 'w': 290, 'h': 40,
'sub_mission':
[{'mission_id': '20-0', 'monsters_number': 3,
'monster': [
{'id': 0, 'max_hp': 742, 'property': 'plant', 'hp_x': 715, 'hp_y': 400, 'cur_hp': 0, 'idx_x': 0,
'idx_y': 0},
{'id': 3, 'max_hp': 742, 'property': 'plant', 'hp_x': 907, 'hp_y': 400, 'cur_hp': 0, 'idx_x': 0,
'idx_y': 0},
{'id': 6, 'max_hp': 742, 'property': 'plant', 'hp_x': 1098, 'hp_y': 400, 'cur_hp': 0, 'idx_x': 0,
'idx_y': 0}]},
{'mission_id': '20-1', 'monsters_number': 3,
'monster': [{'id': 0, 'max_hp': 742, 'property': 'plant', 'hp_x': 713, 'hp_y': 400, 'cur_hp': 0, 'idx_x': 0,
'idx_y': 0},
{'id': 1, 'max_hp': 742, 'property': 'plant', 'hp_x': 810, 'hp_y': 312, 'cur_hp': 0, 'idx_x': 0,
'idx_y': 0},
{'id': 2, 'max_hp': 742, 'property': 'plant', 'hp_x': 810, 'hp_y': 485, 'cur_hp': 0, 'idx_x': 0,
'idx_y': 0}]},
{'mission_id': '20-2', 'monsters_number': 3,
'monster': [
{'id': 0, 'max_hp': 1523, 'property': 'bigstone', 'hp_x': 713, 'hp_y': 230, 'cur_hp': 0, 'idx_x': 0,
'idx_y': 0},
{'id': 3, 'max_hp': 935, 'property': 'bigstone', 'hp_x': 904, 'hp_y': 230, 'cur_hp': 0, 'idx_x': 0,
'idx_y': 0},
{'id': 6, 'max_hp': 935, 'property': 'bigstone', 'hp_x': 1096, 'hp_y': 227, 'cur_hp': 0, 'idx_x': 0,
'idx_y': 0}]}
]
}, {'mission_id': '19', 'mission_number': 3, 'x': 27, 'y': 118, 'w': 290, 'h': 40,
'sub_mission':
[{'mission_id': '19-0', 'monsters_number': 3,
'monster': [
{'id': 1, 'max_hp': 864, 'property': 'stone', 'hp_x': 947, 'hp_y': 291, 'cur_hp': 0, 'idx_x': 0,
'idx_y': 0},
{'id': 3, 'max_hp': 864, 'property': 'plant', 'hp_x': 1061, 'hp_y': 392, 'cur_hp': 0, 'idx_x': 0,
'idx_y': 0},
{'id': 2, 'max_hp': 924, 'property': 'stone', 'hp_x': 947, 'hp_y': 492, 'cur_hp': 0, 'idx_x': 0,
'idx_y': 0}]},
{'mission_id': '19-1', 'monsters_number': 3,
'monster': [
{'id': 1, 'max_hp': 803, 'property': '燈籠', 'hp_x': 948, 'hp_y': 328, 'cur_hp': 0, 'idx_x': 0,
'idx_y': 0},
{'id': 0, 'max_hp': 803, 'property': '燈籠', 'hp_x': 837, 'hp_y': 428, 'cur_hp': 0, 'idx_x': 0,
'idx_y': 0},
{'id': 2, 'max_hp': 803, 'property': '燈籠', 'hp_x': 948, 'hp_y': 528, 'cur_hp': 0, 'idx_x': 0,
'idx_y': 0}]},
{'mission_id': '19-2', 'monsters_number': 3,
'monster': [
{'id': 1, 'max_hp': 1025, 'property': '燈籠', 'hp_x': 948, 'hp_y': 328, 'cur_hp': 0, 'idx_x': 0,
'idx_y': 0},
{'id': 0, 'max_hp': 924, 'property': 'plant', 'hp_x': 837, 'hp_y': 391, 'cur_hp': 0, 'idx_x': 0,
'idx_y': 0},
{'id': 2, 'max_hp': 864, 'property': 'stone', 'hp_x': 948, 'hp_y': 490, 'cur_hp': 0, 'idx_x': 0,
'idx_y': 0}]}
]
}, {'mission_id': '1', 'mission_number': 1, 'x': 27, 'y': 118, 'w': 290, 'h': 40,
'sub_mission':
[{'mission_id': '1-0', 'monsters_number': 3,
'monster': [
{'id': 1, 'max_hp': 375, 'property': 'stone', 'hp_x': 810, 'hp_y': 316, 'cur_hp': 0, 'idx_x': 0,
'idx_y': 0},
{'id': 0, 'max_hp': 375, 'property': 'plant', 'hp_x': 714, 'hp_y': 400, 'cur_hp': 0, 'idx_x': 0,
'idx_y': 0},
{'id': 2, 'max_hp': 375, 'property': 'stone', 'hp_x': 810, 'hp_y': 486, 'cur_hp': 0, 'idx_x': 0,
'idx_y': 0}]}]}
]
def is_used(file_name):
try:
if not os.path.exists(file_name):
print(file_name, 'not exist return false/')
return False
vHandle = win32file.CreateFile(file_name, win32file.GENERIC_READ, 0, None, win32file.OPEN_EXISTING,
win32file.FILE_ATTRIBUTE_NORMAL, None)
result = bool(int(vHandle) == win32file.INVALID_HANDLE_VALUE)
win32file.CloseHandle(vHandle)
except Exception:
# 檔案不存在也會跳來這
return True
return result
class dictmenu(object):
def __init__(self, dicts):
self.dicts = dicts
self.len = len(dicts)
def value_index(self, key=None, value=None):
# print('dicts data:', self.dicts)
# self.dicts.keys()
for idx in range(self.len):
dict = self.dicts[idx]
if type(dict).__name__ == 'dict':
if key and value:
v = dict[key]
if v == value:
return idx, dict
elif key:
v = dict[key]
return idx, dict
else:
array_dict = dict.values()
for i in range(len(array_dict)):
if value in array_dict:
return idx, dict
# if value in array_dict:
# return array_dict.index(value)
else:
print(dict)
return None, None
# if value in self.dicts.value():
#
# pass
return None, None
def multi_value_index(self, key=None, value=None):
answer_idx = []
answer = []
for idx in range(self.len):
dict = self.dicts[idx]
if type(dict).__name__ == 'dict':
if key:
v = dict[key]
if v == value:
answer_idx.append(idx)
answer.append(dict)
# return idx, dict
else:
array_dict = dict.values()
for i in range(len(array_dict)):
if value in array_dict:
answer_idx.append(idx)
answer.append(dict)
# return idx, dict
else:
print(dict)
return None, None
return answer_idx, answer
def detect_number(image):
rawImage = cv2.imread(image)
hight, width, deep = rawImage.shape
gray = cv2.cvtColor(rawImage, cv2.COLOR_BGR2GRAY)
dst = np.zeros((hight, width, 1), np.uint8)
for i in range(0, hight):
for j in range(0, width):
grayPixel = gray[i, j]
dst[i, j] = 255 - grayPixel
ret, binary = cv2.threshold(gray, 0, 255, cv2.THRESH_BINARY + cv2.THRESH_OTSU)
string = pytesseract.image_to_string(binary, lang='eng', config='--psm 6 --oem 3 -c '
'tessedit_char_whitelist'
'=0123456789')
isdigit = any(chr.isdigit() for chr in string)
if isdigit:
# print('hp-ocr:', string)
return string
else:
# print('hp-orc can nott detect number: return None:', string)
return None
def phash(path):
img = cv2.imread(path)
img1 = cv2.resize(img, (32, 32), cv2.COLOR_RGB2GRAY)
h, w = img.shape[:2]
vis0 = np.zeros((h, w), np.float32)
vis0[:h, :w] = img1
img_dct = cv2.dct(cv2.dct(vis0))
img_dct.resize(8, 8)
img_list = np.array().flatten(img_dct.tolist())
img_mean = cv2.mean(img_list)
avg_list = ['0' if i < img_mean else '1' for i in img_list]
return ''.join(['%x' % int(''.join(avg_list[x:x + 4]), 2) for x in range(0, 64, 4)])
# Press the green button in the gutter to run the script.
def classify_gray_hist(image1, image2, size=(256, 256)):
# 先計算直方圖
# 幾個參數必須用方括號括起來
# 這裡直接用灰度圖計算直方圖,所以是使用第一個通道,
# 也可以進行通道分離後,得到多個通道的直方圖
# bins 取為16
image1 = cv2.resize(image1, size)
image2 = cv2.resize(image2, size)
hist1 = cv2.calcHist([image1], [0], None, [256], [0.0, 255.0])
hist2 = cv2.calcHist([image2], [0], None, [256], [0.0, 255.0])
# 可以比較下直方圖
# plt.plot(range(256), hist1, 'r')
# plt.plot(range(256), hist2, 'b')
# plt.show()
# 計算直方圖的重合度
degree = 0
for i in range(len(hist1)):
if hist1[i] != hist2[i]:
degree = degree + (1 - abs(hist1[i] - hist2[i]) / max(hist1[i], hist2[i]))
else:
degree = degree + 1
degree = degree / len(hist1)
return degree
# 計算單通道的直方圖的相似值
# 對圖片進行統一化處理
def get_thum(image, size=(64, 64), greyscale=False):
# 利用image對影象大小重新設定, Image.ANTIALIAS為高質量的
image = image.resize(size, Image.ANTIALIAS)
if greyscale:
# 將圖片轉換為L模式,其為灰度圖,其每個畫素用8個bit表示
image = image.convert('L')
return image
# 計算圖片的餘弦距離
def image_similarity_vectors_via_numpy(image1, image2):
image1 = get_thum(image1)
image2 = get_thum(image2)
images = [image1, image2]
vectors = []
norms = []
for image in images:
vector = []
for pixel_tuple in image.getdata():
vector.append(average(pixel_tuple))
vectors.append(vector)
# linalg=linear(線性)+algebra(代數),norm則表示範數
# 求圖片的範數??
norms.append(linalg.norm(vector, 2))
a, b = vectors
a_norm, b_norm = norms
# dot返回的是點積,對二維陣列(矩陣)進行計算
res = dot(a / a_norm, b / b_norm)
return res
def calculate(image1, image2):
hist1 = cv2.calcHist([image1], [0], None, [256], [0.0, 255.0])
hist2 = cv2.calcHist([image2], [0], None, [256], [0.0, 255.0])
# 計算直方圖的重合度
degree = 0
for i in range(len(hist1)):
if hist1[i] != hist2[i]:
degree = degree + (1 - abs(hist1[i] - hist2[i]) / max(hist1[i], hist2[i]))
else:
degree = degree + 1
degree = degree / len(hist1)
return degree
def detect_card():
card_cascade = cv2.CascadeClassifier('haarcascade_frontalface_default.xml')
img = cv2.imread('2.JPG')
gray = cv2.cvtColor(img, cv2.COLOR_RGB2GRAY)
# faces = card_cascade.detectMultiScale(
# gray,
# scaleFactor=1.08,
# minNeighbors=5,
# minSize=(32, 32))
#
# for (x, y, w, h) in faces:
# cv2.rectangle(img, (x, y), (x + w, y + h), (0, 255, 0), 2)
cv2.namedWindow('img', cv2.WINDOW_NORMAL)
cv2.imshow('img', img)
# cv2.imwrite('result.jpg',img)
cv2.waitKey(0)
cv2.destroyAllWindows()
def snapshot(handle, filepath=GalleryLibrary.Full_Image.value, sleft=0, stop=0,
sright=0, sbot=0):
b = os.path.dirname(filepath)
os.makedirs(b, exist_ok=True)
setForegroundWindows(handle)
image = ImageGrab.grab(bbox=(sleft, stop, sright, sbot))
while True:
isused = is_used(filepath)
if isused:
continue
else:
time.sleep(400 / 1000)
image.save(filepath)
break
def cmpHash(hash1, hash2):
n = 0
# hash長度不同反回-1,此時不能比較
if len(hash1) != len(hash2):
return -1
# 如果hash長度相同遍歷長度
for i in range(len(hash1)):
if hash1[i] != hash2[i]:
n = n + 1
return n
def search_image_position(handle, file1, file2, show, thresh_hold, click=True, shot=True, coordinate='absolute'):
img = cv2.imread(file1)
img_w = img.shape[1]
img_h = img.shape[0]
img2 = img.copy()
template = cv2.imread(file2)
w = template.shape[1]
h = template.shape[0]
# print(w, h)
# All the 6 methods for comparison in a list
# methods = ['cv2.TM_CCOEFF', 'cv2.TM_CCOEFF_NORMED', 'cv2.TM_CCORR',
# 'cv2.TM_CCORR_NORMED', 'cv2.TM_SQDIFF', 'cv2.TM_SQDIFF_NORMED']
methods = ['cv2.TM_CCOEFF']
for meth in methods:
img = img2.copy()
method = eval(meth)
# Apply template Matching
res = cv2.matchTemplate(img, template, method)
min_val, max_val, min_loc, max_loc = cv2.minMaxLoc(res)
# If the method is TM_SQDIFF or TM_SQDIFF_NORMED, take minimum
if method in [cv2.TM_SQDIFF, cv2.TM_SQDIFF_NORMED]:
top_left = min_loc
else:
top_left = max_loc
bottom_right = (top_left[0] + w, top_left[1] + h)
cv2.rectangle(img, top_left, bottom_right, 255, 2)
plt.subplot(121), plt.imshow(res, cmap='gray')
plt.title('Matching Result'), plt.xticks([]), plt.yticks([])
plt.subplot(122), plt.imshow(cv2.cvtColor(img, cv2.COLOR_BGR2RGB))
plt.title('Detected Point'), plt.xticks([]), plt.yticks([])
plt.suptitle(meth)
# print(top_left, bottom_right)
if coordinate == 'absolute':
c_left = top_left[0] + AXIE_WINDOW_PROPERTY['left']
c_top = top_left[1] + AXIE_WINDOW_PROPERTY['top']
c_right = bottom_right[0] + AXIE_WINDOW_PROPERTY['left']
c_bottom = bottom_right[1] + AXIE_WINDOW_PROPERTY['top']
else:
c_left = top_left[0]
c_top = top_left[1]
c_right = bottom_right[0]
c_bottom = bottom_right[1]
shutil.copy2(file2, GalleryLibrary.Temp_Origin.value)
temp_card = GalleryLibrary.Temp_Image.value
if shot and coordinate == 'absolute':
snapshot(axie_handle, temp_card, c_left, c_top, c_right, c_bottom)
else:
cropped = img[c_top:c_bottom, c_left:c_right]
cv2.imwrite(temp_card, cropped)
# print(c_left, c_top, c_right, c_bottom)
c_x = int(round((top_left[0] + bottom_right[0]) / 2, 0))
c_y = int(round((top_left[1] + bottom_right[1]) / 2, 0))
# print("image position:", c_x, c_y)
# img1 = cv2.imread(file2) # 圖庫裡的
# img2 = cv2.imread(temp_card) # 即時抓取的圖
# degree = classify_gray_hist(img1, img2)
img1 = Image.open(file2)
img2 = Image.open(temp_card)
# degree = image_similarity_vectors_via_numpy(img1, img2)
hash1 = imagehash.average_hash(img1)
hash2 = imagehash.average_hash(img2)
degree1 = hash1 - hash2
hash1 = imagehash.dhash(img1)
hash2 = imagehash.dhash(img2)
degree2 = hash1 - hash2
hash1 = imagehash.phash(img1)
hash2 = imagehash.phash(img2)
degree3 = hash1 - hash2
degree = degree1 + degree2 + degree3
# print('degree:', degree1, degree2, degree3, degree)
if (degree <= thresh_hold) and click:
pg.moveTo(c_x + AXIE_WINDOW_PROPERTY['left'], c_y + AXIE_WINDOW_PROPERTY['top'], duration=0.2)
pg.click(c_x + AXIE_WINDOW_PROPERTY['left'], c_y + AXIE_WINDOW_PROPERTY['top'], duration=0.2)
if show:
plt.show()
if coordinate == 'absolute':
x = c_x + AXIE_WINDOW_PROPERTY['left']
y = c_y + AXIE_WINDOW_PROPERTY['top']
else:
x = c_x
y = c_y
return degree, x, y
def compare_hash(file1, file2):
img1 = Image.open(file1)
img2 = Image.open(file2)
# degree = image_similarity_vectors_via_numpy(img1, img2)
hash1 = imagehash.average_hash(img1)
hash2 = imagehash.average_hash(img2)
degree1 = hash1 - hash2
hash1 = imagehash.dhash(img1)
hash2 = imagehash.dhash(img2)
degree2 = hash1 - hash2
hash1 = imagehash.phash(img1)
hash2 = imagehash.phash(img2)
degree3 = hash1 - hash2
degree = degree1 + degree2 + degree3
# print(degree1, degree2, degree3, degree)
return degree
def config_axie_window():
classname = "UnityWndClass"
titlename = "Axie Infinity"
handle = win32gui.FindWindow(classname, titlename)
if handle != 0:
global AXIE_WINDOW_PROPERTY
left, top, right, bottom = win32gui.GetWindowRect(handle)
width, height = (right - left), (bottom - top)
AXIE_WINDOW_PROPERTY['left'] = left
AXIE_WINDOW_PROPERTY['top'] = top
AXIE_WINDOW_PROPERTY['right'] = right
AXIE_WINDOW_PROPERTY['bottom'] = bottom
AXIE_WINDOW_PROPERTY['width'] = width
AXIE_WINDOW_PROPERTY['height'] = height
setForegroundWindows(handle)
print(AXIE_WINDOW_PROPERTY)
return handle
# 將視窗移到最上層,並且拍照
def setForegroundWindows(handle):
text = win32gui.SetForegroundWindow(handle)
def randon_cards(cards, size=10):
idxs = np.random.randint(0, len(cards), size=size)
a = [cards[i] for i in idxs]
return a
def test_all_card(handle):
click_end_turn_button = False
ramdon_cards = sample(CARDS_LIBRARY_LIST, 12)
# ramdon_cards = randon_cards(CARDS_LIBRARY_LIST, 10)
print(ramdon_cards)
for f in CARDS_LIBRARY_LIST:
snapshot(handle, sleft=AXIE_WINDOW_PROPERTY['left'], stop=AXIE_WINDOW_PROPERTY['top'],
sright=AXIE_WINDOW_PROPERTY['right'], sbot=AXIE_WINDOW_PROPERTY['bottom'])
fullpath = join(GalleryLibrary.Cards_Library.value, f)
print(fullpath)
search_image_position(handle, GalleryLibrary.Full_Image.value, fullpath, show=False, click=False,
thresh_hold=0.65)
time.sleep(1)
def black_cards(path, x, y):
# print(x, y)
# pic = '.\\picture\\temp_hp_number_' + id + '.JPG'
img = cv2.imread(path)
# print('img shape:', img.shape)
left = x - 40
top = y - 50
right = x + 40
bottom = y + 50
# pg.moveTo(left, top)
# time.sleep(3)
# pg.moveTo(right, bottom)
# time.sleep(3)
# print(left, top, right, bottom)
cropped = img[top:bottom, left:right]
for x in range(left, right):
for y in range(top, bottom):
a = x - AXIE_WINDOW_PROPERTY['left']
b = y - AXIE_WINDOW_PROPERTY['top']
img[b, a] = (0, 0, 0)
cv2.imwrite(path, img)
# cv2.imshow('a',img)
# plt.show()
# hsv=cv2.cvtColor(cropped,cv2.COLOR_BGR2GRAY)
# h, w, d = cropped.shape
# # print(w, h)
# cropped = cv2.resize(cropped, (w * 5, h * 5))
# cv2.imwrite(path, cropped)
def create_empty_array(x):
empty_array = []
for i in range(0, x):
empty_array.append([]) # 令其轉為1維串列形式
return empty_array
def detect_cards():
cards_library = []
cards_count = 0
snapshot(axie_handle, sleft=AXIE_WINDOW_PROPERTY['left'], stop=AXIE_WINDOW_PROPERTY['top'],
sright=AXIE_WINDOW_PROPERTY['right'], sbot=AXIE_WINDOW_PROPERTY['bottom'])
count = 0
while count < 3:
for f in CARDS_LIBRARY_LIST:
if 'black.JPG' in f :
continue
card_id = str(f[:7])
axie_formation = dictmenu(AXIES_FORMATION)
idx, myaxie = axie_formation.value_index('id', card_id)
if myaxie and myaxie['status'] != AXIE_STATUS_Enum.Normal:
continue
fullpath = join(GalleryLibrary.Cards_Library.value, f)
# search cards
threashold = 25
degree, x, y = search_image_position(axie_handle, GalleryLibrary.Full_Image.value, fullpath, False,
threashold, click=False)
# if '1-1.JPG' in f:
# print(f,":",degree)
if degree <= threashold:
# f_prefix_idx=int(f[:1])-1
cards_library.append(f)
black_cards(GalleryLibrary.Full_Image.value, x, y)
# cards_count = cards_count+1
count = count + 1
# print(degree, x, y)
print(cards_library, len(cards_library))
return len(cards_library), cards_library
def bounds_check(center_x, center_y):
bounds_degree, x, y = search_image_position(axie_handle, GalleryLibrary.Full_Image.value,
GalleryLibrary.Button_SLP_Bounds.value, show=False, thresh_hold=12,
click=False)
if bounds_degree <= 12:
print('[STATUS-WIN] SLP Bounds(拿SLP畫面),點擊離開此畫面 degree ', bounds_degree)
pg.click(center_x, center_y, duration=0.2)
time.sleep(10)
return True
return False
def start_mission_check():
degree_start_mission, x, y = search_image_position(axie_handle, GalleryLibrary.Full_Image.value,
GalleryLibrary.Button_Start_Mission_Button.value, show=False,
thresh_hold=3, click=True)
if degree_start_mission <= 4:
print('[STATUS- new game] start_mission:', degree_start_mission)
time.sleep(5)
return True
return False
def fight_result_check(center_x, center_y):
degree_win, x, y = search_image_position(axie_handle, GalleryLibrary.Full_Image.value,
GalleryLibrary.Button_Victory_Icon.value, show=False,
thresh_hold=3, click=False)
degree_lost, x, y = search_image_position(axie_handle, GalleryLibrary.Full_Image.value,
GalleryLibrary.Button_Defeated_Icon.value, show=False,
thresh_hold=3, click=False)
# print('degree win/lost:', degree_win, degree_lost)
#
if degree_win <= 3 or degree_lost <= 3:
corner_x = AXIE_WINDOW_PROPERTY['right'] - 20
corner_y = AXIE_WINDOW_PROPERTY['bottom'] - 20
print('[STATUS-WIN], 點擊,離開關卡勝利畫面')
pg.moveTo(corner_x, corner_y, duration=0.2)
# 點擊,離開 關卡說你勝利的畫面
pg.click(corner_x, corner_y, duration=0.2)
time.sleep(5)
print('[STATUS-WIN], 點擊,離開 經驗值獎勵畫面, 若沒體力則不會有這畫面')
# 點擊,離開 恭喜勝利畫面(包含經驗值畫面)
pg.click(center_x, center_y, duration=0.2)
time.sleep(5)
print('[STATUS-WIN], 點擊,離開 SLP獎勵畫面, 若沒體力則不會有這畫面')
# 點擊,離開 恭喜勝利畫面(包含經驗值畫面)
pg.click(center_x, center_y, duration=0.2)
time.sleep(5)
if degree_win <= 3:
return True, degree_win
else:
return False, degree_lost
return None, None
def snapshot_axies_runtime():
for formation in AXIES_FORMATION:
axie_id = formation['id']
axie_position_id = formation['position_id']
axie_position = AXIES_POSITION_ID[axie_position_id]
axie_center_x = axie_position['x'] + AXIE_WINDOW_PROPERTY['left']
axie_center_y = axie_position['y'] + AXIE_WINDOW_PROPERTY['top']
# print(AXIE_WINDOW_PROPERTY['left'], AXIE_WINDOW_PROPERTY['top'], axie_center_x, axie_center_y)
#
# pg.moveTo(axie_center_x, axie_center_y, duration=0.3)
# time.sleep(2)
# #
# r取得runtime axies的完整圖像
for shape in AXIE_RUNTIME_SNAPSHOP_LOCATION:
if axie_id in shape['id']:
left = axie_center_x + shape['left']
top = axie_center_y + shape['top']
right = axie_center_x + shape['right']
bottom = axie_center_y + shape['bottom']
path = GalleryLibrary.AXIE_RUNTIME_FULL.value + '\\' + axie_id + '.JPG'
snapshot(axie_handle, filepath=path, sleft=left, stop=top,
sright=right, sbot=bottom)
# 取得axie頭上的debuff圖像
for shape in AXIE_RUNTIME_DEBUFF_SNAPSHOP_LOCATION:
if axie_id in shape['id']:
left = axie_center_x + shape['left']
top = axie_center_y + shape['top']
right = axie_center_x + shape['right']
bottom = axie_center_y + shape['bottom']
path = GalleryLibrary.AXIE_RUNTIME_DEBUFF.value + '\\' + axie_id + '.JPG'
snapshot(axie_handle, filepath=path, sleft=left, stop=top,
sright=right, sbot=bottom)
def detect_axie_hp(status):
# find all axies's position
# 移除沒有hp值的axie
# for f in status:
# id = f['id']
# status = f['status']
# status_id = f['status_id']
# for h in axie_hp_status:
# if id in h['id']:
# h['status'] = status
# if status_id != 0:
# axie_hp_status.remove(h)
# print('which axies detect hp:', axie_hp)
MAX = 7 # 找血量 抓5次的狀況
retry = 3 #
count = 0
# len(axie_hp_status)
for axie_stat in status:
axie_stat.update({'cur_hp': 0})
axie_stat.update({'debuff': AXIE_DEBUFF.Nothing})
# 移除沒有hp值的axie, 0是normal,不是0代表沒有血量條了
status = axie_stat['status']
if status != 'normal':
continue
id = axie_stat['id']
debuff = []
debuff_threshold = 50
# while retry > 0:
# count = 0
hp = []
while count < MAX:
# snapshot_axies_runtime()
# 檢查debuff
axie_debuff_path = GalleryLibrary.AXIE_RUNTIME_DEBUFF.value + '\\' + id + '.JPG'
degree, x, y = search_image_position(axie_handle, axie_debuff_path,
GalleryLibrary.Button_Debuff_1_Icon.value, show=False,
thresh_hold=debuff_threshold, click=False, coordinate='relative')
# print('debuff degree,x,y:', degree, x, y)
debuff.append(degree)
# 檢查hp
normal_axie = GalleryLibrary.AXIE_RUNTIME_FULL.value + '\\' + id + '.JPG'
# axie_pic = '.\\picture\\temp_axie.JPG'
for f in listdir(GalleryLibrary.AXIE_HP_Icon.value):
file = join(GalleryLibrary.AXIE_HP_Icon.value, f)
degree, x, y = search_image_position(axie_handle, normal_axie, file,
show=False, thresh_hold=80, click=False, coordinate='relative')
# print('hp degree,x,y:', degree, x, y)
pic = '.\\picture\\temp_hp_number_' + id + '.JPG'
img = cv2.imread(normal_axie)
# print('img shape:', img.shape)
left = x + 13
top = y - 10
right = x + 65
bottom = y + 10
cropped = img[top:bottom, left:right]
h, w, d = cropped.shape
# print(w, h)
cropped = cv2.resize(cropped, (w * 10, h * 10))
cv2.imwrite(pic, cropped)
# 側測數字
temp_hp_number = detect_number(pic)
hp_number = ''
if temp_hp_number:
for chr in temp_hp_number:
# print(chr, "is digit?", chr.isdigit())
if chr.isdigit():
hp_number = hp_number + chr
else:
break
# print('type hp:',type(hp))
# print('hp :',hp)
hp.append(hp_number)
print(id, ' hp is ', hp_number)
# print(hp_number.rstrip('\r\n'))
# 這段容易有處理影像的bug,先high起來
# pic = '.\\picture\\temp_hp_len_' + id + '.JPG'
# left = x + 55
# top = y - 10
# right = x + 130
# bottom = y + 10
# cropped = img[top:bottom, left:right]
# cv2.imwrite(pic, cropped)
count = count + 1
if len(hp_number) >= 3:
break
if hp and len(hp):
# print()
axie_stat.update({'cur_hp': int(max(hp))})
if len(debuff):
degree = int(sum(debuff) / len(debuff))
else:
degree = None
# print("final debuff degree:", degree)
if degree and degree <= debuff_threshold:
# f['debuff'].append(AXIE_DEBUFF.DISABLE_ONE_CARD)
axie_stat.update({'debuff': AXIE_DEBUFF.DISABLE_ONE_CARD})
# print(hp)
# print(axie_hp_status)
# return axie_hp_status
# return status
def snapshot_axies_pvp_runtime():
# AXIE_PVP_SNAPSHOP = {'left': -90, 'top': -160, 'right': 75, 'bottom': -20}
# AXIE_PVP_POSITION_ID = [
# {'id': 0, 'x': 772, 'y': 496, 'row': 0, 'col': 1, 'rule': POSITION_RUEL.SINGLE},
axie_pvp_hp_status = []
for position in AXIE_PVP_POSITION_ID:
axie_position_id = position['id']
axie_center_x = position['x'] + AXIE_WINDOW_PROPERTY['left']
axie_center_y = position['y'] + AXIE_WINDOW_PROPERTY['top']
left = axie_center_x + AXIE_PVP_SNAPSHOP['left']
top = axie_center_y + AXIE_PVP_SNAPSHOP['top']
right = axie_center_x + AXIE_PVP_SNAPSHOP['right']
bottom = axie_center_y + AXIE_PVP_SNAPSHOP['bottom']
# print(AXIE_WINDOW_PROPERTY['left'], AXIE_WINDOW_PROPERTY['top'], axie_center_x, axie_center_y)