-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgenerate_unit_data.py
More file actions
1756 lines (1669 loc) · 68.6 KB
/
Copy pathgenerate_unit_data.py
File metadata and controls
1756 lines (1669 loc) · 68.6 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
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
#!/usr/bin/env python3
# -*- coding:utf-8 -*-
"""
"""
import csv
from collections import OrderedDict
import copy
import json
import os
import shutil
import sys
from tqdm import tqdm
dir_to_data = sys.argv[1]
if os.path.exists(os.path.join("./tracking_files", "characters_wikidata.json")):
shutil.copyfile(
os.path.join("./tracking_files", "characters_wikidata.json"),
os.path.join("./local_files", "old_characters_wikidata.json"),
)
effect_icon_size = 20
Elements = {1: "日", 2: "月", 3: "火", 4: "水", 5: "木", 6: "金", 7: "土", 8: "星", 9: "无"}
BulletCategory = {
1: "通常弹",
2: "镭射弹",
3: "体术弹",
4: "斩击弹",
5: "动能弹",
6: "流体弹",
7: "能量弹",
8: "御符弹",
9: "光弹",
10: "尖头弹",
11: "追踪弹",
}
Roles = {1: "防御式", 2: "支援式", 3: "回复式", 4: "干扰式", 5: "攻击式", 6: "技巧式", 7: "速攻式", 8: "破坏式"}
RareCategory = {
0: "未知",
1: "常驻/限定",
2: "超限定",
3: "Relic限定",
4: "Epic限定",
5: "Genic限定",
2.5: "EX限定",
648: "白FES限定",
0.5: "油库里",
2.25: "通行证限定",
}
AbnormalCategory = {1: "燃烧", 2: "冻结", 3: "感电", 4: "毒雾", 5: "黑暗"}
AbnormalCategoryEng = {
1: "burning",
2: "frozen",
3: "electrified",
4: "poisoning",
5: "blackout",
}
AbnormalSimpleCategory = {1: "烧", 2: "冰", 3: "电", 4: "毒", 5: "暗"}
BuffEffectCategory = {
1: "阳攻",
2: "阳防",
3: "阴攻",
4: "阴防",
5: "速度",
6: "命中",
7: "回避",
8: "会心攻击",
9: "会心防御",
10: "会心命中",
11: "会心回避",
12: "仇恨",
103: "阳攻阴攻",
105: "阳攻速度",
106: "阳攻命中",
108: "阳攻会心攻击",
110: "阳攻会心命中",
112: "阳攻仇恨",
205: "阳防速度",
209: "阳防会心防御",
211: "阳防会心回避",
304: "阴攻阴防",
305: "阳攻速度",
306: "阳攻命中",
308: "阴攻会心攻击",
310: "阴攻会心命中",
405: "阴防速度",
406: "阴防命中",
407: "阴防回避",
408: "阴防会心攻击",
711: "回避会心回避",
810: "会心攻击会心命中",
911: "会心防御会心回避",
}
AbnormalBreakCategory = {12: "焚灭", 13: "融冰", 14: "放电", 15: "猛毒", 16: "闪光"}
VoiceCategory = {
1: "语音 自我介绍",
2: "语音 紫心",
3: "语音 蓝心",
4: "语音 绿心",
5: "语音 橙心",
6: "语音 粉心",
7: "语音 转生",
8: "语音 强化完成",
9: "语音 登录",
10: "语音 主页1",
11: "语音 主页2",
12: "语音 主页3",
13: "语音 春",
14: "语音 夏",
15: "语音 秋",
16: "语音 冬",
17: "语音 任务",
18: "语音 任务完成",
19: "语音 信箱",
20: "语音 归来",
21: "语音 派遣完成",
22: "语音 反应1",
23: "语音 反应2",
24: "语音 反应3",
25: "语音 战斗开始",
26: "语音 进入下波战斗",
27: "语音 胜利",
28: "语音 败北",
29: "语音 增幅1",
30: "语音 增幅2",
31: "语音 增幅3",
32: "语音 擦弹1",
33: "语音 擦弹2",
34: "语音 擦弹3",
35: "语音 技能A",
36: "语音 技能B",
37: "语音 指令A",
38: "语音 指令B",
39: "语音 指令C",
40: "语音 指令D",
41: "语音 换人退场",
42: "语音 换人登场",
43: "语音 射击A",
44: "语音 射击B",
45: "语音 符卡A口述1",
46: "语音 符卡A口述2",
47: "语音 符卡A宣言",
48: "语音 符卡B口述1",
49: "语音 符卡B口述2",
50: "语音 符卡B宣言",
51: "语音 终符口述1",
52: "语音 终符口述2",
53: "语音 终符宣言",
54: "语音 伤害",
55: "语音 大伤害",
56: "语音 卡片",
57: "语音 擦弹发动",
58: "语音 增幅·回复",
59: "语音 无法战斗",
60: "语音 标题",
61: "语音 肯定回答",
62: "语音 否定回答",
63: "语音 感谢",
64: "语音 低声自语",
65: "语音 决胜台词",
}
def is_fake_unit(unit_data):
return unit_data["symbol_name"] == "" or unit_data["alias_name"] == "_TEST"
def file_maker(name, size):
return "[[File:" + name + "|" + str(size) + "px]]".replace("#", "")
def tegong_maker(name):
return "[" + name + "特攻]"
def bullet_effect_maker(name, rate, description):
if rate == -1:
return "[" + name + "]" + description
return "[" + name + "]" + "[" + str(rate) + "%]" + description
allowed_chars = (
[chr(i) for i in range(ord("A"), ord("Z") + 1)]
+ [chr(i) for i in range(ord("a"), ord("z") + 1)]
+ [chr(i) for i in range(ord("0"), ord("9") + 1)]
+ [".", "&", "#", ">", "=", "<", "$", "○", "∫", "'", "-", ";", "≦", "≪"]
)
def check_chars(c_mark):
for c in c_mark:
if c not in allowed_chars:
print(c_mark)
assert c in allowed_chars
def replace_mark(s):
new_s = s
new_s = new_s.replace("#", "#")
new_s = new_s.replace(">", ">")
new_s = new_s.replace("&", "&")
new_s = new_s.replace("=", "=")
new_s = new_s.replace("<", "<")
new_s = new_s.replace("$", "$")
new_s = new_s.replace("'", "‘")
new_s = new_s.replace("-", "-")
new_s = new_s.replace(";", ";")
new_s = new_s.replace("≦", "≦")
new_s = new_s.replace("≪", "≪")
return new_s
def process_cmark(c_mark, c_id):
check_chars(c_mark)
new_c_mark = copy.copy(c_mark)
new_c_mark = replace_mark(new_c_mark)
if c_id == 2927:
new_c_mark += "-幻月"
if c_id == 2937:
new_c_mark += "-神绮"
if c_id == 3905:
new_c_mark += "-魅魔"
if c_id == 3926:
new_c_mark += "-梦月"
return new_c_mark
def load_csv(path_to_csv):
data = {}
with open(path_to_csv) as csvfile:
reader = csv.DictReader(csvfile)
for row in reader:
rowid = int(row["id"])
assert rowid not in data
data[rowid] = row
return data
def load_master_json(table_name):
data = {}
with open(os.path.join(dir_to_data, table_name + "Table.json")) as jsonfile:
for line in jsonfile:
row = json.loads(line)
rowid = int(row["id"])
assert rowid not in data
data[rowid] = row
return data
# load master data
unit_datas = load_master_json("Unit")
race_datas = load_master_json("Race")
unit_race_datas = load_master_json("UnitRace")
skill_datas = load_master_json("Skill")
resist_datas = load_master_json("Resist")
ability_datas = load_master_json("Ability")
characteristic_datas = load_master_json("Characteristic")
skill_effect_datas = load_master_json("SkillEffect")
shot_datas = load_master_json("Shot")
spell_card_datas = load_master_json("Spellcard")
bullet_datas = load_master_json("Bullet")
bullet_addon_datas = load_master_json("BulletAddon")
bullet_extra_effect_datas = load_master_json("BulletExtraEffect")
bullet_critical_race_datas = load_master_json("BulletCriticalRace")
bgm_datas = load_master_json("Bgm")
item_datas = load_master_json("Item")
costume_datas = load_master_json("Costume")
person_relation_datas = load_master_json("PersonRelation")
unit_rank_promote_datas = load_master_json("UnitRankPromote")
picture_datas = load_master_json("Picture")
item_datas = load_master_json("Item")
voice_datas = load_master_json("Voice")
voice_set_datas = load_master_json("VoiceSet")
# load custom data
unit_dates = load_csv("./UnitDate.csv")
hit_check_order_raw = load_csv(os.path.join("./local_files/", "HitCheckOrderTable.csv"))
time_duration_raw = load_csv(
os.path.join("./local_files/", "TimelineDurationTable.csv")
)
# preprocessing
person_id_to_id = {}
for key in unit_datas:
unit_data = unit_datas[key]
if is_fake_unit(unit_data):
continue
c_id = int(unit_data["id"])
p_id = int(unit_data["person_id"])
if p_id not in person_id_to_id:
person_id_to_id[p_id] = []
person_id_to_id[p_id].append(c_id)
unit_races = {}
for key in unit_race_datas:
unit_race_data = unit_race_datas[key]
c_id = int(unit_race_data["unit_id"])
if c_id not in unit_races:
unit_races[c_id] = []
unit_races[c_id].append(int(unit_race_data["race_id"]))
bullet_critical_races = {}
for key in bullet_critical_race_datas:
bullet_critical_race_data = bullet_critical_race_datas[key]
b_id = int(bullet_critical_race_data["bullet_id"])
if b_id not in bullet_critical_races:
bullet_critical_races[b_id] = []
bullet_critical_races[b_id].append(int(bullet_critical_race_data["race_id"]))
unit_costumes = {}
for key in costume_datas:
costume_data = costume_datas[key]
c_id = int(costume_data["unit_id"])
if c_id not in unit_costumes:
unit_costumes[c_id] = []
unit_costumes[c_id].append(int(costume_data["id"]))
person_relations = {}
for key in person_relation_datas:
person_relation_data = person_relation_datas[key]
p_id1 = int(person_relation_data["person_id"])
p_id2 = int(person_relation_data["target_person_id"])
if p_id1 not in person_id_to_id or p_id2 not in person_id_to_id:
continue
c_ids1 = person_id_to_id[p_id1]
c_ids2 = person_id_to_id[p_id2]
for c_id1 in c_ids1:
for c_id2 in c_ids2:
if c_id1 not in person_relations:
person_relations[c_id1] = []
person_relations[c_id1].append(c_id2)
rank_promotes = {}
for key in unit_rank_promote_datas:
unit_rank_promote_data = unit_rank_promote_datas[key]
c_id = int(unit_rank_promote_data["unit_id"])
rank = int(unit_rank_promote_data["rank"])
if c_id not in rank_promotes:
rank_promotes[c_id] = {}
rank_promotes[c_id][rank] = unit_rank_promote_data
voices = {}
for key in voice_datas:
voice_data = voice_datas[key]
c_id = int(voice_data["unit_id"])
v_type = int(voice_data["voice_type_id"])
v_text = voice_data["voice_text"]
if c_id not in voices:
voices[c_id] = {}
voices[c_id][v_type] = v_text
voice_sets = {}
for key in voice_set_datas:
voice_set_data = voice_set_datas[key]
c_id = int(voice_set_data["unit_id"])
f_id = int(voice_set_data["file_id"])
if c_id not in voice_sets:
voice_sets[c_id] = {}
voice_sets[c_id][f_id] = (voice_set_data["name"], voice_set_data["cast_name"])
time_durations = {}
for key in time_duration_raw:
time_duration_data = time_duration_raw[key]
c_id = int(time_duration_data["unit_id"])
if c_id not in time_durations:
time_durations[c_id] = {}
time_durations[c_id][int(time_duration_data["barrage_id"])] = (
time_duration_data["time1"],
time_duration_data["time3"],
)
hit_check_orders = {}
for key in hit_check_order_raw:
hit_check_order_data = hit_check_order_raw[key]
boost_id = int(hit_check_order_data["boost_id"])
if boost_id != 3:
continue
c_id = int(hit_check_order_data["unit_id"])
if c_id not in hit_check_orders:
hit_check_orders[c_id] = {}
hit_check_orders[c_id][
int(hit_check_order_data["barrage_id"])
] = hit_check_order_data["hit_check_order"]
def simplify_skill_effect(
c_id, skill_index, effect_index, generated_description, skill_effect_id
):
skill_effect_data = skill_effect_datas[skill_effect_id]
se_type = int(skill_effect_data["type"])
se_subtype = int(skill_effect_data["subtype"])
se_range = int(skill_effect_data["range"])
def skill_effect_raise_exception():
ud = unit_datas[c_id]
ud_name = ud["name"] + ud["symbol_name"]
print(
c_id,
ud_name,
skill_index,
effect_index,
generated_description,
se_type,
se_subtype,
se_range,
"not handled",
)
assert False
result = ""
if se_type == 1: # buff
special = False
if se_range == 1:
result += "自身"
elif se_range == 2:
result += "我方"
elif se_range == 3:
result += "目标"
special = True
elif se_range == 4:
result += "敌方"
special = True
else:
skill_effect_raise_exception()
if se_subtype == 12: # 仇恨是特别的,上升下降都正常
special = False
if se_subtype not in BuffEffectCategory:
skill_effect_raise_exception()
result += BuffEffectCategory[se_subtype]
if special:
result += "上升"
elif se_type == 2: # debuff
special = False
if se_range == 1:
result += "自身"
special = True
elif se_range == 2:
result += "我方"
special = True
elif se_range == 3:
result += "目标"
elif se_range == 4:
result += "敌方"
else:
skill_effect_raise_exception()
if se_subtype == 12: # 仇恨是特别的,上升下降都正常
special = False
if se_subtype not in BuffEffectCategory:
skill_effect_raise_exception()
result += BuffEffectCategory[se_subtype]
if special:
result += "下降"
elif se_type == 3: # 回血
if se_range == 1:
result += "自身"
elif se_range == 2:
result += "我方"
else:
skill_effect_raise_exception()
result += "回血"
elif se_type == 4: # 回盾
if se_range == 1:
result += "自身"
elif se_range == 2:
result += "我方"
else:
skill_effect_raise_exception()
result += "回盾"
elif se_type == 5: # 回灵
if se_range == 1:
result += "自身"
elif se_range == 2:
result += "我方"
else:
skill_effect_raise_exception()
result += "回灵"
elif se_type == 6: # 上异常
if se_range == 1:
result += "自身"
elif se_range == 2:
result += "我方"
elif se_range == 3:
result += "目标"
elif se_range == 4:
result += "敌方"
else:
skill_effect_raise_exception()
result += "上" + AbnormalSimpleCategory[se_subtype]
elif se_type == 8: # 行动顺序
if se_range == 1:
result += "自身"
elif se_range == 2:
result += "我方"
else:
skill_effect_raise_exception()
if se_subtype == 1:
result += "先行"
elif se_subtype == 2:
result += "后行"
else:
skill_effect_raise_exception()
elif se_type == 9: # 恢复结界异常
if se_range == 1:
result += "自身"
elif se_range == 2:
result += "我方"
else:
skill_effect_raise_exception()
result += "回结界异常"
elif se_type == 10: # 开锁
if se_range == 1:
result += "自身"
elif se_range == 2:
result += "我方"
else:
skill_effect_raise_exception()
result += "开锁"
elif se_type == 12: # 受到弹种伤害降低
if se_range == 1:
result += "自身"
elif se_range == 2:
result += "我方"
else:
skill_effect_raise_exception()
result += BulletCategory[se_subtype]
result += "防"
elif se_type == 13: # 受到属性伤害降低
if se_range == 1:
result += "自身"
elif se_range == 2:
result += "我方"
else:
skill_effect_raise_exception()
result += Elements[se_subtype]
result += "防"
elif se_type == 14: # 受到某种族伤害降低
if se_range == 1:
result += "自身"
elif se_range == 2:
result += "我方"
else:
skill_effect_raise_exception()
result += "特防"
elif se_type == 15: # 弹种威力上升
if se_range == 1:
result += "自身"
elif se_range == 2:
result += "我方"
else:
skill_effect_raise_exception()
result += BulletCategory[se_subtype]
result += "加伤"
elif se_type == 16: # 属性威力上升
if se_range == 1:
result += "自身"
elif se_range == 2:
result += "我方"
else:
skill_effect_raise_exception()
result += Elements[se_subtype]
result += "加伤"
elif se_type == 41: # 二阶buff
if se_range == 1:
result += "自身"
elif se_range == 2:
result += "我方"
else:
skill_effect_raise_exception()
result += BuffEffectCategory[se_subtype]
elif se_type == 42: # 二阶debuff
if se_range == 3:
result += "目标"
elif se_range == 4:
result += "敌方"
else:
skill_effect_raise_exception()
result += BuffEffectCategory[se_subtype]
elif se_type == 43: # 上弱点
if se_range == 3:
result += "目标"
elif se_range == 4:
result += "敌方"
else:
skill_effect_raise_exception()
result = ""
result += "加弱"
result += Elements[se_subtype]
elif se_type == 46: # 每回合持续增益
if se_range == 1:
result += "自身"
elif se_range == 2:
result += "我方"
else:
skill_effect_raise_exception()
result = ""
result += "缓慢"
if se_subtype == 3:
result += "回血"
elif se_subtype == 4:
result += "回盾"
elif se_subtype == 5:
result += "回灵"
elif se_subtype == 10:
result += "开锁"
else:
skill_effect_raise_exception()
elif se_type == 47: # 共鸣(根据前台角色数量增益)
if se_range == 1:
result += "自身"
elif se_range == 2:
result += "我方"
else:
skill_effect_raise_exception()
result = ""
if se_subtype == 5:
result += "速度"
elif se_subtype == 6:
result += "灵力"
elif se_subtype == 7:
result += "伤害"
elif se_subtype == 8:
result += "暴伤"
elif se_subtype == 9:
result += "暴击率"
else:
skill_effect_raise_exception()
result += "共鸣"
elif se_type == 48: # 蓄力(根据某些状态加伤)
if se_range == 1:
result += "自身"
elif se_range == 2:
result += "我方"
else:
skill_effect_raise_exception()
result = ""
if se_subtype == 3:
result += "体蓄力"
elif se_subtype == 4:
result += "盾蓄力"
elif se_subtype == 5:
result += "灵蓄力"
else:
skill_effect_raise_exception()
elif se_type == 49: # 有利/不利增伤
if se_range == 1:
result += "自身"
elif se_range == 2:
result += "我方"
else:
skill_effect_raise_exception()
result = ""
if se_subtype == 1:
result += "有利增伤"
elif se_subtype == 2:
result += "不利增伤"
else:
skill_effect_raise_exception()
elif se_type == 51: # 减冷却
if se_range == 1:
result += "自身"
elif se_range == 2:
result += "我方"
else:
skill_effect_raise_exception()
result = ""
result += "减冷却"
if se_subtype == 1:
pass
else:
skill_effect_raise_exception()
elif se_type == 52: # 符卡延迟
if se_range == 3:
result += "目标"
elif se_range == 4:
result += "敌方"
else:
skill_effect_raise_exception()
result = ""
if se_subtype == 2:
result += "符卡延迟"
else:
skill_effect_raise_exception()
elif se_type == 54: # 大结界
result += "大结界"
elif se_type == 55: # 油库里共鸣
if se_range == 1:
result += "自身"
elif se_range == 2:
result += "我方"
else:
skill_effect_raise_exception()
result = ""
result += "油库里"
if se_subtype == 5:
result += "速度共鸣"
elif se_subtype == 6:
result += "灵力"
elif se_subtype == 7:
result += "伤害"
elif se_subtype == 8:
result += "暴伤"
elif se_subtype == 9:
result += "暴击率"
else:
skill_effect_raise_exception()
result += "共鸣"
elif se_type == 56: # 永久buff
special = False
if se_range == 1:
result += "自身"
elif se_range == 2:
result += "我方"
else:
skill_effect_raise_exception()
result += "永久"
result += BuffEffectCategory[se_subtype]
elif se_type == 57: # 永久debuff
if se_range == 3:
result += "目标"
elif se_range == 4:
result += "敌方"
else:
skill_effect_raise_exception()
result += "永久"
result += BuffEffectCategory[se_subtype]
elif se_type == 58: # 属性转换(根据自身某属性加全体某属性)
if se_range == 1:
result += "自身"
elif se_range == 2:
result += "我方"
else:
skill_effect_raise_exception()
result = ""
if se_subtype == 2:
result += "自身阳防转我方阳攻"
elif se_subtype == 3:
result += "自身阴攻转我方阳攻"
elif se_subtype == 5:
result += "自身速力转我方阳攻"
elif se_subtype == 6:
result += "自身阳攻转我方阳防"
elif se_subtype == 13:
result += "自身阴攻转我方阴攻"
elif se_subtype == 14:
result += "自身阴防转我方阴攻"
elif se_subtype == 15:
result += "自身速力转我方阴攻"
elif se_subtype == 23:
result += "自身阴攻转我方速度"
else:
skill_effect_raise_exception()
elif se_type == 59: # 特定人数
result += "特定人数"
else:
skill_effect_raise_exception()
return result
def get_rare_for_wiki(unit_data):
c_id = int(unit_data["id"])
c_rare = int(unit_data["limitbreak_item_id"]) - 500
if int(c_id) == 2937 or int(c_id) == 3905 or int(c_id) == 2927 or int(c_id) == 3926:
# 秘封组 -> Genic限定(等级为5)
return 5
elif int(c_id) == 7037 or int(c_id) == 7038 or int(c_id) == 7039:
# 白限
return 648
elif int(c_id) == 11009 or int(c_id) == 15037 or int(c_id) == 27002 or int(c_id) == 28001:
# 通行证限定
return 2.25
elif int(c_id) >= 50000 and int(c_id) < 60000:
# 油库里
return 0.5
elif int(c_id) == 8018 or int(c_id) == 12050 or int(c_id) == 16051 or int(c_id) == 17004 or int(c_id) == 20003:
# 未知
return 0
elif c_rare == 3 or c_rare == 4:
# Epic放Relic前面
return 7 - c_rare
elif c_rare == 5:
# 大限
return 2.5
if c_rare == -500:
print(c_id)
assert False
return c_rare
def generate_costume_info(characters, c_id):
characters["初始皮肤名称"] = ""
characters["初始皮肤描述"] = ""
characters["皮肤编号组"] = ""
characters["皮肤名称组"] = ""
characters["皮肤描述组"] = ""
if c_id not in unit_costumes:
return
for costume_id in unit_costumes[c_id]:
costume_data = costume_datas[costume_id]
if int(costume_data["file_id"]) == 1:
characters["初始皮肤名称"] = costume_data["name"]
characters["初始皮肤描述"] = costume_data["description"]
else:
if characters["皮肤编号组"] != "":
characters["皮肤编号组"] += "、"
if characters["皮肤名称组"] != "":
characters["皮肤名称组"] += "/"
if characters["皮肤描述组"] != "":
characters["皮肤描述组"] += "/"
characters["皮肤编号组"] += str(costume_data["file_id"]).zfill(2)
characters["皮肤名称组"] += costume_data["name"]
characters["皮肤描述组"] += costume_data["description"]
def generate_time_duration(characters, c_id):
characters["扩散总时长(未加速)"] = ""
characters["扩散总时长(加速)"] = ""
characters["集中总时长(未加速)"] = ""
characters["集中总时长(加速)"] = ""
characters["1符总时长(未加速)"] = ""
characters["1符总时长(加速)"] = ""
characters["2符总时长(未加速)"] = ""
characters["2符总时长(加速)"] = ""
characters["终符总时长(未加速)"] = ""
characters["终符总时长(加速)"] = ""
if c_id not in time_durations:
return
dur = time_durations[c_id]
characters["扩散总时长(未加速)"] = dur[1][0]
characters["扩散总时长(加速)"] = dur[1][1]
characters["集中总时长(未加速)"] = dur[2][0]
characters["集中总时长(加速)"] = dur[2][1]
characters["1符总时长(未加速)"] = dur[3][0]
characters["1符总时长(加速)"] = dur[3][1]
characters["2符总时长(未加速)"] = dur[4][0]
characters["2符总时长(加速)"] = dur[4][1]
characters["终符总时长(未加速)"] = dur[7][0]
characters["终符总时长(加速)"] = dur[7][1]
def generate_hit_check_order(characters, c_id):
prefixes = ["扩散", "集中", "1符", "2符", "终符"]
barrage_ids = [1, 2, 3, 4, 7]
for prefix in prefixes:
for i in range(6):
spell_order_str = prefix + "段落" + str(i + 1)
characters[spell_order_str] = ""
characters[spell_order_str + "首发"] = ""
if c_id not in hit_check_orders:
return
for index, prefix in enumerate(prefixes):
barrage_id = barrage_ids[index]
hco = hit_check_orders[c_id][barrage_id]
if "empty" in hco:
for i in range(6):
spell_order_str = prefix + "段落" + str(i + 1)
characters[spell_order_str] = ""
characters[spell_order_str + "首发"] = ""
else:
spell_order = []
spell_order_count = []
for i, bullet in enumerate(hco):
if bullet not in spell_order:
spell_order.append(bullet)
spell_order_count.append(i + 1)
for i in range(6):
spell_order_str = prefix + "段落" + str(i + 1)
characters[spell_order_str] = int(spell_order[i])
characters[spell_order_str + "首发"] = spell_order_count[i]
def generate_overall_elements(characters, c_id):
element_list = []
for temp_count in range(1, 7):
if (
"1符" + str(temp_count) + "属性" in characters
and characters["1符" + str(temp_count) + "属性"] not in element_list
):
if characters["1符" + str(temp_count) + "属性"] != "无":
element_list.append(characters["1符" + str(temp_count) + "属性"])
if (
"2符" + str(temp_count) + "属性" in characters
and characters["2符" + str(temp_count) + "属性"] not in element_list
):
if characters["2符" + str(temp_count) + "属性"] != "无":
element_list.append(characters["2符" + str(temp_count) + "属性"])
if (
"终符" + str(temp_count) + "属性" in characters
and characters["终符" + str(temp_count) + "属性"] not in element_list
):
if characters["终符" + str(temp_count) + "属性"] != "无":
element_list.append(characters["终符" + str(temp_count) + "属性"])
temp_string = ""
for element in element_list:
temp_string = temp_string + "、" + element
temp_string = temp_string[1:]
characters["检索用弹幕属性"] = temp_string
def generate_friendship_characters(characters, c_id):
characters["羁绊角色"] = ""
characters["羁绊角色编号"] = ""
if c_id not in person_relations:
return
person_relation = person_relations[c_id]
characters["羁绊角色"] = "、".join(
[
unit_datas[c_id2]["name"] + unit_datas[c_id2]["symbol_name"]
for c_id2 in person_relation
]
)
characters["羁绊角色编号"] = "、".join([str(c_id2) for c_id2 in person_relation])
def generate_rank_promote(characters, c_id):
name_list = ["体力", "阳攻", "阳防", "阴攻", "阴防", "速度"]
for rank in range(5):
for slot in range(6):
item_name_str = "升格" + str(rank + 1) + name_list[slot] + "所需材料"
item_num_str = item_name_str + "数量"
characters[item_num_str] = ""
characters[item_name_str] = ""
if c_id not in rank_promotes:
return
for rank in range(5):
unit_rank_promote_data = rank_promotes[c_id][rank]
for slot in range(6):
item_name_str = "升格" + str(rank + 1) + name_list[slot] + "所需材料"
item_num_str = item_name_str + "数量"
item_type = int(
unit_rank_promote_data["slot" + str(slot + 1) + "_object_type"]
)
item_id = int(unit_rank_promote_data["slot" + str(slot + 1) + "_object_id"])
item_num = int(
unit_rank_promote_data["slot" + str(slot + 1) + "_object_value"]
)
characters[item_num_str] = item_num
if item_type == 10:
item_name = "PTS" + str(picture_datas[item_id]["id"])
else:
assert item_type == 12
item_name = (
item_datas[item_id]["name"].replace("[", "-").replace("]", "-")
)
characters[item_name_str] = item_name
def generate_voice(characters, c_id):
# display_voice_types = [i for i in range(1, 66)]
display_voice_types = (
[i for i in range(1, 29)]
+ [i for i in range(41, 45)]
+ [i for i in range(56, 60)]
)
for v_type in display_voice_types:
characters[VoiceCategory[v_type]] = ""
if c_id not in voices:
return
for v_type in display_voice_types:
characters[VoiceCategory[v_type]] = voices[c_id][v_type]
def generate_cv_info(characters, c_id):
for cv_id in range(1, 4):
characters["角色声音" + str(cv_id)] = ""
characters["角色CV" + str(cv_id)] = ""
if c_id not in voice_sets:
return
for cv_id in range(1, 4):
if cv_id not in voice_sets[c_id]:
continue
sound, cv_name = voice_sets[c_id][cv_id]
characters["角色声音" + str(cv_id)] = sound
characters["角色CV" + str(cv_id)] = cv_name
def fixup_return_line(characters):
for key in characters:
if isinstance(characters[key], str):
characters[key] = characters[key].replace("\n", "<br>")
characters_json = {}
for key in tqdm(unit_datas):
unit_data = unit_datas[key]
if is_fake_unit(unit_data):
continue
# 基础属性
c_id = int(unit_data["id"])
c_name = unit_data["name"]
c_title = unit_data["alias_name"]
c_name_short = unit_data["short_name"]
c_mark = unit_data["symbol_name"]
c_symbol_title = unit_data["symbol_title"]