少年修仙传客户端代码仓库
client_Wu Xijin
2019-04-16 fc714208ff3a320c3bb52bddd5ea3d91f647a206
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
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
using System.Collections.Generic;
using UnityEngine;
 
public static class AttackHandler
{
    /// <summary>
    /// 攻击者服务器id, 被击者服务器id, 攻击类型, 伤害
    /// </summary>
    public static UnityEngine.Events.UnityAction<uint, uint, byte, uint> OnAttackTarget;
 
    public static void HandlerAttackTarget(GActorFight attacker,
                                           GActorFight target,
                                           int hurtValue,
                                           byte attackType,
                                           int skillID,
                                           int soConfigID,
                                           SoConfigBase soConfig,
                                           bool canDie)
    {
        if (target == null)
        {
            return;
        }
 
        int _hitEffectId = -1;
        Skill _skill = attacker.SkillMgr.Get(skillID);
 
        foreach (var _buffId in GeneralDefine.BuffToHitEffect.Keys)
        {
            if (_skill.cacheBuffList.Contains(_buffId))
            {
                _hitEffectId = GeneralDefine.BuffToHitEffect[_buffId];
                break;
            }
        }
 
        if (_hitEffectId != -1)
        {
            SFXController _controller = target.MP_Hit ?
                SFXPlayUtility.Instance.PlayEffectAsync(_hitEffectId,
                                                        target.MP_Hit.position,
                                                        Vector3.forward) :
                SFXPlayUtility.Instance.PlayEffectAsync(_hitEffectId,
                                                        target.Root.position,
                                                        Vector3.forward);
 
            if (CameraController.Instance.CameraObject)
            {
                _controller.transform.rotation = CameraController.Instance.CameraObject.transform.rotation * Quaternion.Euler(0, 0, Random.Range(0, 360));
            }
 
            // 播放受击音效
            if (target.ActorType == GameObjType.gotNPC)
            {
                target.PlayHurtAudio(attacker);
            }
        }
        else
        {
            if ((attacker.ServerInstID == PlayerDatas.Instance.PlayerId
             || (attacker.ActorInfo.ownerSID != 0
              && attacker.ActorInfo.ownerSID == PlayerDatas.Instance.PlayerId)))
            {
                if (attackType != (int)HurtAttackType.Miss
                 && attackType != (int)HurtAttackType.Recovery
                 && soConfig.floodPercent != 0)
                {
                    target.DoFlashWhite();
                }
 
                if (soConfig.hitEffectId != 0)
                {
                    SFXController _controller = target.MP_Hit
                        ? SFXPlayUtility.Instance.PlayEffectAsync(soConfig.hitEffectId,
                                                                  target.MP_Hit.position,
                                                                  Vector3.forward) :
                          SFXPlayUtility.Instance.PlayEffectAsync(soConfig.hitEffectId,
                                                                  target.Root.position,
                                                                  Vector3.forward);
                    // 播放受击音效
                    if (target.ActorType == GameObjType.gotNPC)
                    {
                        target.PlayHurtAudio(attacker);
                    }
                }
            }
        }
 
        if (soConfig.floodPercent != 0)
        {
            if (target.CanAtkedRotate())
            {
                target.Forward = target.destForward = MathUtility.ForwardXZ(attacker.Pos, target.Pos);
            }
        }
 
        if (!canDie && attackType != (int)HurtAttackType.Miss && attackType != (int)HurtAttackType.Recovery)
        {
            //if (soConfig.hitPauseTime > 0)
            //{
            //target.DoAnimatorPause(soConfig.hitPauseTime);//???
            //}
 
            // 决定目标是否处于释放不能打断的技能中
            bool _canInterrupt = true;
            if (target.SkillMgr.CurCastSkill != null)
            {
                if (!target.SkillMgr.CurCastSkill.SkillCompelete)
                {
                    if (target.SkillMgr.CurCastSkill.skillInfo.soFile != null)
                    {
                        _canInterrupt = target.SkillMgr.CurCastSkill.skillInfo.soFile.interrupt;
                    }
                }
            }
 
            if (CheckHitEffect(attacker, target, skillID))
            {
                if (soConfig.floodPercent > 0
                && (_skill.skillInfo.soFile != null && _canInterrupt))
                {
                    if (soConfig.hitType == E_HitType.Hurt)
                    {
                        target.Hurt();
                    }
                    else if (soConfig.hitType == E_HitType.HitDown)
                    {
                        target.HurtDown();
                    }
                }
            }
 
            if (CheckPull(attacker, target, soConfig.bodyControlId))
            {
                target.StartBeatBack(attacker.ServerInstID, soConfig.bodyControlId, MathUtility.ForwardXZ(target.Pos, attacker.Pos), (HurtAttackType)attackType);
            }
        }
 
        // 是否计算血量
        bool _calculateHp = hurtValue != 0;
 
        // 是否显示飘字
        bool _popHp = (attackType == (byte)HurtAttackType.Miss || _calculateHp);
 
        bool _alive = target.ActorInfo.RealHp > 0;
 
        if (_calculateHp)
        {
            if (!PreFightMission.Instance.IsFinished())
            {
                if (target.ServerInstID == PlayerDatas.Instance.baseData.PlayerID)
                {
                    int _realHurt = hurtValue;
                    int _limit = (int)(PlayerDatas.Instance.extersion.MaxHP * 0.4f);
                    if (PlayerDatas.Instance.baseData.HP - hurtValue < _limit)
                    {
                        _realHurt = hurtValue - (_limit - ((int)PlayerDatas.Instance.baseData.HP - hurtValue));
                    }
                    float _pencent = PlayerDatas.Instance.baseData.HP * 1f / PlayerDatas.Instance.extersion.MaxHP;
                    if (_pencent > 0.4f)
                    {
                        target.ActorInfo.ReduceHp((uint)_realHurt);
                        PlayerDatas.Instance.FightRefreshPlayerHp((uint)target.ActorInfo.Hp);
                    }
                }
                else if (target is GA_NpcClientFightBoss)
                {
                    if ((int)target.ActorInfo.RealHp - (int)hurtValue < 10)
                    {
                        hurtValue = (int)target.ActorInfo.RealHp - 10;
                    }
 
                    target.ActorInfo.ReduceHp((uint)hurtValue);
                }
                else
                {
                    target.ActorInfo.ReduceHp((uint)hurtValue);
                }
            }
            else
            {
                // 处理封魔坛英雄伤害
                FakeDemonJarDungeonStage _dungeon = StageLoad.Instance.currentStage as FakeDemonJarDungeonStage;
                ClientHazyDemonKingStage _clientHazyDemonStage = StageLoad.Instance.currentStage as ClientHazyDemonKingStage;
                if (_dungeon != null)
                {
                    if (attacker.ServerInstID == PlayerDatas.Instance.PlayerId)
                    {
                        _dungeon.AddHeroHurt(hurtValue);
                    }
                }
                else if (_clientHazyDemonStage != null)
                {
 
                }
                else
                {
                    bool _doReduceHp = true;
 
                    if (attacker is GA_NpcClientFightNorm)
                    {
                        if (target.ActorInfo.RealHp <= (target.ActorInfo.RealMaxHp * .5f))
                        {
                            hurtValue = 0;
                        }
                    }
                    else if (target is GA_NpcClientFightNorm)
                    {
                        if ((target as GA_NpcClientFightNorm).NpcConfig.AIType == 198)
                        {
                            _doReduceHp = false;
                        }
                    }
 
                    if (_doReduceHp)
                    {
                        target.ActorInfo.ReduceHp((uint)hurtValue);
                    }
 
                    if (target.ServerInstID == PlayerDatas.Instance.baseData.PlayerID)
                    {
                        PlayerDatas.Instance.FightRefreshPlayerHp((uint)target.ActorInfo.RealHp);
                    }
 
                    if (ClientDungeonStageUtility.isClientDungeon
#if UNITY_EDITOR
                    || RuntimeLogUtility.TEST_CLIENT_PVP
#endif
                    )
                    {
                        if (target.ServerInstID == PlayerDatas.Instance.PlayerId && target.ActorInfo.RealHp == 0)
                        {
                            GA_PVPClientPlayer.Result(false);
                            var _hero = target as GA_Hero;
                            if (_hero != null)
                            {
                                _hero.Die();
                                if (_hero.State == E_ActorState.AutoRun)
                                {
                                    _hero.StopPathFind();
                                }
                                _hero.StopRush();
                                _hero.Behaviour.StopHandupAI(true);
                            }
                        }
                    }
                }
 
                if (target.ServerInstID == PlayerDatas.Instance.PlayerId)
                {
                    GA_Hero _hero = target as GA_Hero;
                    if (_hero.SelectTarget == null)
                    {
                        _hero.SelectTarget = attacker;
                    }
                }
            }
        }
 
        if (_popHp)
        {
            GAStaticDefine.PopHp(attacker, target, attackType, hurtValue);
        }
 
        if (_alive)
        {
            if (target.ActorInfo.RealHp == 0)
            {
                target.KillerPos = attacker.Pos;
            }
        }
 
        if (canDie && target.ActorInfo.RealHp == 0)
        {
            target.Die(attacker.ServerInstID, soConfig.deadFlyId, (byte)attackType);
        }
 
        if (target.ActorInfo.serverDie
         && soConfig.floodPercent > 0)
        {
            target.ReleaseLifeBar();
            if (target.ActorType != GameObjType.gotPlayer)
            {
                target.ReleaseName();
            }
        }
 
        if (OnAttackTarget != null)
        {
            OnAttackTarget(attacker.ServerInstID, target.ServerInstID, attackType, (uint)hurtValue);
        }
 
#if UNITY_EDITOR
        if (hurtValue != 0 && attacker.ActorType == GameObjType.gotPlayer)
        {
            string _content = string.Format("STM_BaseAttack => {0} 使用技能:{1} 的 {2} 插帧, 攻击了 {3}, 伤害为: {4}, 剩余血量: {5}, 是否可以死亡: {6}",
                                            attacker.ServerInstID,
                                            soConfigID,
                                            skillID,
                                            target.ServerInstID,
                                            hurtValue,
                                            target.ActorInfo.RealHp,
                                            canDie);
            RuntimeLogUtility.AddLog_Blue(_content, target.ServerInstID);
        }
#endif
    }
 
    public static void CalculateDamage(GActorFight attacker,
                                       GActorFight target,
                                       Skill skill,
                                       int hitTime,
                                       ref uint hurtValue,
                                       ref byte attackType)
    {
        int _hitRate = 1;
        int _missRate = 0;
 
        int _aSuperHitRate = 0;
        int _aLuckyHitRate = 0;
        int _aZhuXianHitRate = 0;
 
        bool _isMiss = false;
        bool _isCrit = false;
        bool _isLucky = false;
        bool _isZhuxianHit = false;
 
        SkillHelper.EffectValue _effectValue;
 
        float _aAtkSkillPer = 0;
        int _atkSkillValue = 0;
        int _aZhuxianHurtPer = 0;
        int _aLuckyHit = 0;// 会心一击伤害加成    万分率, 默认0, 会心一击时有值
        float _aSuperHit = 0;// 暴击伤害            固定值, 默认0, 暴击时有值
        int _aMinAtk = 1;// 最小攻击            固定值
        int _aMaxAtk = 1;// 最大攻击            固定值
        int _aIceAtk = 0;// 真实伤害            固定值
        int _aIgnoreDefRate = 0;// 无视防御比率        万分率
        int _aSkillAtkRate = 0;// 技能伤害加成        万分率
        int _aDamagePer = 0;// 伤害加成            万分率
        //int _aDamagePerPVP = 0;// PVP伤害加成            万分率
        int _aFinalHurt = 0;// 最终伤害加成        固定值
        int _aIceAtkSuperHit = 1;// 真实伤害暴击倍值    倍值, 默认1
        int _aOnlyFinalHurt = 0;
        int _aFinalHurtPer = 0;
        int _superHit = 0;
        int _luckyHit = 0;
        int _aNPCHurtAddPer = 0;
 
        //int _dLuckyHitReduce = 0;// 会心一击伤害减少    万分率, 默认0, 会心一击时有值
        //int _dSuperHitReduce = 0;// 暴击伤害减少        万分率, 默认0, 暴击时有值
        int _dDamChanceDef = 0;// 抵御伤害比例        万分率, 默认0, 只在格挡成功才有值, 格挡成功率默认20%
        int _dDef = 0;// 防御值                固定值
        int _dIceDef = 1;// 真实伤害防御        固定值
        //int _dIgnoreDefRateReduce = 0;// 无视防御比率抗性    万分率
        //int _dSkillAtkRateReduce = 0;// 技能伤害减少        万分率
        int _dDamReduce = 0;// 伤害减少            万分率
        //int _dDamagePerPVPReduce = 0;// PVP伤害减少            万分率
        int _dFinalHurtReduce = 0;// 最终伤害减少        固定值
 
        #region 伤害替换
 
        GActorNpcFight _npc = target as GActorNpcFight;
 
        if (_npc != null && _npc.NpcConfig.IsBoss == 0)
        {
            // 没有1009的时候使用1010
            if (!skill.skillInfo.effectValue.TryGetValue(1009, out _effectValue))
            {
                skill.skillInfo.effectValue.TryGetValue(1010, out _effectValue);
            }
            else
            {
#if UNITY_EDITOR
                if (RuntimeLogUtility.s_SkillEffectLog)
                {
                    Debug.LogFormat("替换了1010为1009", _effectValue.value1);
                }
#endif
            }
        }
        else
        {
            skill.skillInfo.effectValue.TryGetValue(1010, out _effectValue);
        }
 
        _aAtkSkillPer = _effectValue.value1;
        _atkSkillValue = _effectValue.value2;// 技能固定值(1010或者1009的value2)
 
        if (skill.skillInfo.config.FuncType == 1
         || skill.skillInfo.config.FuncType == 2)
        {
            _atkSkillValue += PlayerDatas.Instance.baseData.FabaoHurt;
            _aAtkSkillPer += PlayerDatas.Instance.baseData.FabaoHurtPer;
        }
        else if (skill.skillInfo.config.FuncType == 8)
        {
            _atkSkillValue += PlayerDatas.Instance.baseData.NormalHurt;
            _aAtkSkillPer += PlayerDatas.Instance.baseData.NormalHurtPer;
        }
 
        #endregion
 
        #region 伤害衰减或者递增
 
        skill.skillInfo.effectValue.TryGetValue(1056, out _effectValue);
        float _atkReduceRate = _effectValue.value1;
        if (_effectValue.value2 == 0)
        {
            _aAtkSkillPer = _aAtkSkillPer - (hitTime * _atkReduceRate);
        }
        else if (_effectValue.value2 == 1)
        {
            _aAtkSkillPer = _aAtkSkillPer + (hitTime * _atkReduceRate);
        }
 
        #endregion
 
        // -------------- 指定防御方属性 --------------
        if (target.ActorType == GameObjType.gotNPC)
        {
            GActorNpcFight _npcBase = target as GActorNpcFight;
            if (_npcBase == null)
            {
                return;
            }
 
            _missRate = _npcBase.NpcConfig.MissRate;
            _dDef = _npcBase.NpcConfig.Def;
        }
        else if (target.ActorType == GameObjType.gotPlayer)
        {
            _missRate = PlayerDatas.Instance.extersion.Miss;
        }
 
        // -------------- 指定攻击方属性 --------------
        if (attacker.ActorType == GameObjType.gotPlayer)
        {
            float _rate = 1f;
            if (attacker is GA_PVPClientPlayer)
            {
                _rate = GeneralDefine.ClientPvpAttributePer;
            }
            _hitRate = PlayerDatas.Instance.extersion.HIT;
            _aSuperHitRate = PlayerDatas.Instance.extersion.SuperHitRate;
            _aLuckyHitRate = PlayerDatas.Instance.extersion.luckHitRate;
            _aZhuxianHurtPer = PlayerDatas.Instance.extersion.zhuxianHurtPer;
            _aZhuXianHitRate = PlayerDatas.Instance.extersion.zhuxianRate;
            _aMaxAtk = (int)(PlayerDatas.Instance.extersion.MAXATK * _rate);
            _aMinAtk = (int)(PlayerDatas.Instance.extersion.MINATK * _rate);
            _aIgnoreDefRate = PlayerDatas.Instance.extersion.IgnoreDefRate;
            _aSkillAtkRate = PlayerDatas.Instance.extersion.SkillAtkRate;
            _aDamagePer = PlayerDatas.Instance.extersion.DamagePer;
            _aFinalHurt = (int)(PlayerDatas.Instance.extersion.FinalHurt);
            _aIceAtk = (int)(PlayerDatas.Instance.extersion.realATK * _rate);
            _aOnlyFinalHurt = PlayerDatas.Instance.extersion.OnlyFinalHurt;
            _luckyHit = PlayerDatas.Instance.extersion.luckHitVal;
            _superHit = PlayerDatas.Instance.extersion.SuperHit;
            _aNPCHurtAddPer = PlayerDatas.Instance.extersion.NpcHurtAddPer;
            _aFinalHurtPer = PlayerDatas.Instance.extersion.FunalHurtPer;
        }
        else if (attacker.ActorType == GameObjType.gotNPC)
        {
            GActorNpcFight _npcBase = attacker as GActorNpcFight;
            if (_npcBase == null)
            {
                return;
            }
 
            _hitRate = _npcBase.NpcConfig.Hit;
 
            _isCrit = IsCrit(_npcBase.NpcConfig.SuperHiteRate);
 
            _aMaxAtk = _npcBase.NpcConfig.MaxAtk;
            _aMinAtk = _npcBase.NpcConfig.MinAtk;
        }
 
        _isMiss = IsMiss(_hitRate, _missRate);
        _isCrit = IsCrit(_aSuperHitRate);
        _isLucky = IsLucky(_aLuckyHitRate);
        _isZhuxianHit = IsZhuXianHit(_aZhuXianHitRate);
 
        // 4014 必定触发 按位配置 1为必命中,2为必暴击,4为必会心一击
        if (skill.skillInfo.effectValue.TryGetValue(4014, out _effectValue))
        {
            if ((_effectValue.value1 & 0x1) == 1)
            {
                _isMiss = false;
            }
 
            if ((_effectValue.value1 & 0x10) == 1)
            {
                _isCrit = true;
            }
 
            if ((_effectValue.value1 & 0x100) == 1)
            {
                _isLucky = true;
            }
 
#if UNITY_EDITOR
            if (RuntimeLogUtility.s_SkillEffectLog)
            {
                Debug.LogFormat("技能 {0} 触发了效果 {1} , 命中: {2}, 暴击: {3}, 会心: {4}",
                    skill.id,
                    4014,
                    (_effectValue.value1 & 0x1) == 1,
                    (_effectValue.value1 & 0x10) == 1,
                    (_effectValue.value1 & 0x100) == 1);
            }
#endif
        }
 
        // 4510 buff中攻击必命中
        if (StatusMgr.Instance.TryGetSkillEffectValue(attacker.ServerInstID, 4510, out _effectValue))
        {
            _isMiss = false;
        }
 
        // 如果MISS, 则不再进行计算
        if (_isMiss)
        {
            hurtValue = 0;
            attackType = (byte)HurtAttackType.Miss;
            return;
        }
 
        _aLuckyHit = _isLucky ? _luckyHit : 0;
        _aSuperHit = _isCrit ? _superHit : 0;
 
 
        // 4051 当发生会心伤害时, 增加会心一击伤害
        if (_isLucky
         && skill.skillInfo.effectValue.TryGetValue(4051, out _effectValue))
        {
            _aLuckyHit += _effectValue.value1;
        }
 
        // HurtType == 2 为pve类型
        if (skill.skillInfo.config.HurtType == 2
         || skill.skillInfo.config.HurtType == 0)
        {
            // 处理本身的技能
            CalculateSkillEffect(attacker, target, skill.skillInfo, ref _aDamagePer, ref _aAtkSkillPer, ref _atkSkillValue, ref _aIceAtk, ref _aFinalHurt, ref _aSuperHit, _isCrit);
 
            // 处理sp技能
            List<SkillHelper.SkillInfo> _spSkillList = SkillHelper.Instance.GetSpSkill(skill.id);
 
            if (_spSkillList != null)
            {
                for (int i = 0; i < _spSkillList.Count; ++i)
                {
                    CalculateSkillEffect(attacker, target, _spSkillList[i], ref _aDamagePer, ref _aAtkSkillPer, ref _atkSkillValue, ref _aIceAtk, ref _aFinalHurt, ref _aSuperHit, _isCrit);
                }
            }
        }
 
        _aAtkSkillPer = _aAtkSkillPer * Constants.F_DELTA;
        Dictionary<int, int> _attrValues;
        if (Snxxz.UI.CalculateSkillGetAttrHurtUtility.Instance.TryGetAttrDictBySkill(skill.id, out _attrValues))
        {
            foreach (var _per in _attrValues.Values)
            {
                _aAtkSkillPer += (_per * Constants.F_DELTA);
            }
        }
 
        // -------------- 公式计算 --------------
        float _value1;
        float _value2;
        float _value3;
 
        // PVE
        if (attacker.ActorType == GameObjType.gotPlayer
         && (target.ActorType == GameObjType.gotNPC || target is GA_PVPClientPlayer))
        {
            //"PVE_1"    :"int(max((((max((aMaxAtk if isLuckyHit else (aMinAtk + (aMaxAtk - aMinAtk)*rand))
            //            -dDef*max(1-aIgnoreDefRate/10000.0,0),1))*(1+(aLuckyHit/10000.0 if isLuckyHit else 0))
            //            +(aSuperHit if isSuperHit else 0)+ max(aIceAtkSuperHit*aIceAtk - dIceDef, 0))
            //            *(atkSkillPer+(aZhuxianHurtPer/10000.0 if isZhuxianHit else 0)+aSkillAtkRate/10000.0)
            //            *(1+aDamagePer/10000.0)+max(aFinalHurt+aOnlyFinalHurt-dFinalHurtReduce, 0)
            //            +atkSkillValue)*(1+dBeHurtPer/10000.0)*max(1+aFinalHurtPer/10000.0,1)
            //            +aNPCHurtAddPer/10000.0*(aMinAtk+aMaxAtk)/2.0,(aMinAtk+aMaxAtk)/2*0.05 + (aMinAtk+aMaxAtk)/2*0.1*rand))"
 
            float _random = Random.Range(0f, 1f);
            _value1 = _aMinAtk + (_aMaxAtk - _aMinAtk) * _random;
 
#if UNITY_EDITOR
            if (RuntimeLogUtility.s_HurtValueLog)
            {
                Debug.LogFormat("_aMinAtk + (_aMaxAtk - _aMinAtk) * _random = {0}", _value1);
            }
#endif
            _value2 = _dDef * Mathf.Max(1 - _aIgnoreDefRate * Constants.F_DELTA, 1);
 
#if UNITY_EDITOR
            if (RuntimeLogUtility.s_HurtValueLog)
            {
                Debug.LogFormat("_dDef * Mathf.Max(1 - _aIgnoreDefRate * Constants.F_DELTA, 1) = {0}", _value2);
            }
#endif
            _value3 = _isLucky ? _aMaxAtk : _value1;
 
#if UNITY_EDITOR
            if (RuntimeLogUtility.s_HurtValueLog)
            {
                Debug.LogFormat("_isLucky ? _aMaxAtk : _value1 = {0}", _value3);
            }
#endif      
            _value3 = _value3 - _value2;
 
#if UNITY_EDITOR
            if (RuntimeLogUtility.s_HurtValueLog)
            {
                Debug.LogFormat("_value3 - _value2 = {0}", _value3);
            }
#endif
 
            _value3 = Mathf.Max(_value3, 1);
 
#if UNITY_EDITOR
            if (RuntimeLogUtility.s_HurtValueLog)
            {
                Debug.LogFormat("Mathf.Max(_value3, 1) = {0}", _value3);
            }
#endif
 
            _value1 = 1 + (_isLucky ? _aLuckyHit * Constants.F_DELTA : 0);
 
#if UNITY_EDITOR
            if (RuntimeLogUtility.s_HurtValueLog)
            {
                Debug.LogFormat("1 + (_isLucky ? _aLuckyHit * Constants.F_DELTA : 0) = {0}", _value1);
            }
#endif
 
            _value3 *= _value1;
 
#if UNITY_EDITOR
            if (RuntimeLogUtility.s_HurtValueLog)
            {
                Debug.LogFormat("_value3 *= _value1 = {0}", _value3);
            }
#endif
 
            _value3 += _aSuperHit;
 
#if UNITY_EDITOR
            if (RuntimeLogUtility.s_HurtValueLog)
            {
                Debug.LogFormat("_value3 += _aSuperHit = {0}", _value3);
            }
#endif
 
            _value3 += Mathf.Max(_aIceAtkSuperHit * _aIceAtk - _dIceDef, 0);
 
#if UNITY_EDITOR
            if (RuntimeLogUtility.s_HurtValueLog)
            {
                Debug.LogFormat("_value3 += Mathf.Max(_aIceAtkSuperHit * _aIceAtk - _dIceDef, 0) = {0}", _value3);
            }
#endif
 
            _value1 = (_aAtkSkillPer + (_isZhuxianHit ? _aZhuxianHurtPer * Constants.F_DELTA : 0) + _aSkillAtkRate * Constants.F_DELTA) * (1 + _aDamagePer * Constants.F_DELTA);
 
#if UNITY_EDITOR
            if (RuntimeLogUtility.s_HurtValueLog)
            {
                Debug.LogFormat("(_aAtkSkillPer + _aSkillAtkRate * Constants.F_DELTA) * (1 + _aDamagePer * Constants.F_DELTA) = {0}", _value1);
            }
#endif
 
            _value3 *= _value1;
 
#if UNITY_EDITOR
            if (RuntimeLogUtility.s_HurtValueLog)
            {
                Debug.LogFormat("_value3 *= _value1", _value3);
            }
#endif
 
            _value3 += _aFinalHurt + _aOnlyFinalHurt + _atkSkillValue;
 
#if UNITY_EDITOR
            if (RuntimeLogUtility.s_HurtValueLog)
            {
                Debug.LogFormat("_value3 += _aFinalHurt + _aOnlyFinalHurt + _atkSkillValue  = {0}", _value3);
            }
#endif
 
            _value2 = Mathf.Max(1 + _aFinalHurtPer * Constants.F_DELTA, 1);
            _value3 *= _value2;
 
            _value2 = _aNPCHurtAddPer * Constants.F_DELTA * (_aMinAtk + _aMaxAtk) * .5f;
            _value3 += _value2;
 
            //(aMinAtk+aMaxAtk)/2*0.05 + (aMinAtk+aMaxAtk)/2*0.1*rand)
            _random = Random.Range(0f, 1f);
            _value1 = (_aMinAtk + _aMaxAtk) * .5f * .05f + (_aMinAtk + _aMaxAtk) * .5f * .1f * _random;
 
#if UNITY_EDITOR
            if (RuntimeLogUtility.s_HurtValueLog)
            {
                Debug.LogFormat("(_aMinAtk + _aMaxAtk) * .5f * .3f + (_aMinAtk + _aMaxAtk) * .5f * .2f * _random  = {0}", _value3);
            }
#endif
            hurtValue = (uint)Mathf.Max(_value3, _value1);
 
#if UNITY_EDITOR
            if (RuntimeLogUtility.s_HurtValueLog)
            {
                Debug.LogFormat("(uint)Mathf.Max(_value3, _value1) = {0}", _value3);
            }
#endif
        }
        // EVP
        else if ((attacker.ActorType == GameObjType.gotNPC
              && target.ActorType == GameObjType.gotPlayer) || attacker is GA_PVPClientPlayer)
        {
            // "EVP_1"    :"max((max((aMinAtk+aMaxAtk)/2.0-dDef,0)+max(aIceAtk - dIceDef, 0))*(atkSkillPer+aSkillAtkRate/10000.0)*(1-min(dDamReduce,8000)/10000.0)*(1-min(dDamChanceDef,8000)/10000.0)+max(aFinalHurt-dFinalHurtReduce, 0)+atkSkillValue,1)"
 
            _value1 = Mathf.Max((_aMaxAtk + _aMinAtk) * .5f - _dDef, 0);
            _value2 = Mathf.Max(_aIceAtk - _dIceDef, 0);
            _value1 += _value2;
 
            _value2 = (1 - Mathf.Min(_dDamReduce, 8000) * Constants.F_DELTA);
            _value3 = (1 - Mathf.Min(_dDamChanceDef, 8000) * Constants.F_DELTA);
 
            _value1 = _value1 * _value2 * (_aAtkSkillPer + _aSkillAtkRate * Constants.F_DELTA) * _value3;
            _value2 = Mathf.Max(_aFinalHurt - _dFinalHurtReduce, 0);
            _value1 += _value2;
            _value3 = 1 + 4 * Random.Range(0f, 1f);
 
            hurtValue = (uint)Mathf.Max(_value1, _value3);
        }
 
        if (_isZhuxianHit)
        {
            attackType = (byte)HurtAttackType.ZhuXianAtk;
        }
        else if (_isLucky
#if UNITY_EDITOR
        || RuntimeLogUtility.s_ForceLuckHit
#endif
        )
        {
            attackType = (byte)HurtAttackType.LuckyHit;
        }
        else if (_isCrit
#if UNITY_EDITOR
        || RuntimeLogUtility.s_ForceSupperHit
#endif
        )
        {
            attackType = (byte)HurtAttackType.SuperHit;
        }
        else
        {
            attackType = (byte)HurtAttackType.Normal;
        }
    }
 
    private static bool IsMiss(int hit, int miss)
    {
        return hit * 1f / (hit + miss) - Random.Range(0f, 1f) < 0;
    }
 
    private static bool IsCrit(int superHitRate)
    {
        return Random.Range(0, 10000) < superHitRate;
    }
 
    private static bool IsLucky(int luckHitRate)
    {
        return Random.Range(0, 10000) < luckHitRate;
    }
 
    private static bool IsZhuXianHit(int zxHitRate)
    {
        return Random.Range(0, 10000) < zxHitRate;
    }
 
    private static float HpPer(GActor actor)
    {
        return actor.ActorInfo.RealHp * 1f / actor.ActorInfo.RealMaxHp;
    }
 
    private static void CalculateSkillEffect(GActorFight attacker, GActorFight target, SkillHelper.SkillInfo skillInfo,
                                             ref int _aDamagePer,
                                             ref float _aAtkSkillPer,
                                             ref int _atkSkillValue,
                                             ref int _aIceAtk,
                                             ref int _aFinalHurt,
                                             ref float _aSuperHit,
                                             bool _isCrit)
    {
        SkillHelper.EffectValue _effectValue;
        #region 伤害增加
        // 4002 目标血量低于XX百分比提高伤害xx
        if (skillInfo.effectValue.TryGetValue(4002, out _effectValue))
        {
            if (HpPer(target) < _effectValue.value2 * Constants.F_DELTA)
            {
                _aDamagePer += _effectValue.value1;
#if UNITY_EDITOR
                if (RuntimeLogUtility.s_SkillEffectLog)
                {
                    Debug.LogFormat("技能 {0} 触发了效果 {1} , aDamagePer 增加了 {2}", skillInfo.config.SkillID, 4002, _effectValue.value1);
                }
#endif
            }
        }
 
        if (skillInfo.effectValue.TryGetValue(1062, out _effectValue))
        {
            GActorNpcFight _npcFight = target as GActorNpcFight;
 
            if (_npcFight != null)
            {
                if (_npcFight.NpcConfig.PoisionDef == _effectValue.value3)
                {
                    _aAtkSkillPer += _effectValue.value1;
                    _atkSkillValue += _effectValue.value2;
#if UNITY_EDITOR
                    if (RuntimeLogUtility.s_SkillEffectLog)
                    {
                        Debug.LogFormat("技能 {0} 触发了效果 {1} , _aAtkSkillPer 翻了 {2} 倍", skillInfo.config.SkillID, 1062, _effectValue.value2 * Constants.F_DELTA);
                    }
#endif
                }
            }
        }
 
        // 4003 目标处于XX状态提高伤害 _aDamagePer ???
        if (skillInfo.effectValue.TryGetValue(4003, out _effectValue))
        {
            if (target.ActorInfo.status4012.ContainsKey((byte)_effectValue.value2)
             && target.ActorInfo.status4012[(byte)_effectValue.value2] > 0)
            {
                _aDamagePer += _effectValue.value1;
#if UNITY_EDITOR
                if (RuntimeLogUtility.s_SkillEffectLog)
                {
                    Debug.LogFormat("技能 {0} 触发了效果 {1} , aDamagePer 增加了 {2}", skillInfo.config.SkillID, 4003, _effectValue.value1);
                }
#endif
            }
        }
 
 
        // 4005 概率增加攻击(技能)伤害万分率
        if (skillInfo.effectValue.TryGetValue(4005, out _effectValue))
        {
            if (Random.Range(0, 10000) < _effectValue.value2)
            {
                _aAtkSkillPer += _effectValue.value1;
#if UNITY_EDITOR
                if (RuntimeLogUtility.s_SkillEffectLog)
                {
                    Debug.LogFormat("技能 {0} 触发了效果 {1} , _aAtkSkillPer 增加了 {2}", skillInfo.config.SkillID, 4005, _effectValue.value1);
                }
#endif
            }
        }
 
        // 4035 增加技能伤害万分率
        if (skillInfo.effectValue.TryGetValue(4035, out _effectValue))
        {
            bool _isValid = true;
            var _mapConfig = MapConfig.Get(PlayerDatas.Instance.baseData.MapID);
            if (_mapConfig.MapFBType != 0)
            {
                var _funcConfig = FuncConfigConfig.Get("SkillXPAddByFB");
                if (!_funcConfig.Numerical1.Contains(PlayerDatas.Instance.baseData.MapID.ToString()))
                {
                    _isValid = false;
                }
            }
 
            if (_isValid)
            {
                _aAtkSkillPer += _effectValue.value1;
#if UNITY_EDITOR
                if (RuntimeLogUtility.s_SkillEffectLog)
                {
                    Debug.LogFormat("技能 {0} 触发了效果 {1} , _aAtkSkillPer 增加了 {2}", skillInfo.config.SkillID, 4035, _effectValue.value1);
                }
#endif
            }
        }
 
        // 4011 暴击时增加技能伤害
        if (skillInfo.effectValue.TryGetValue(4011, out _effectValue))
        {
            if (_isCrit)
            {
                _aAtkSkillPer += _effectValue.value1;
 
#if UNITY_EDITOR
                if (RuntimeLogUtility.s_SkillEffectLog)
                {
                    Debug.LogFormat("技能 {0} 触发了效果 {1} , _aAtkSkillPer 增加了 {2}", skillInfo.config.SkillID, 4011, _effectValue.value1);
                }
#endif
            }
        }
 
        // 4015 目标处于XX状态提高技能伤害
        if (skillInfo.effectValue.TryGetValue(4015, out _effectValue))
        {
            if (target.ActorInfo.status4012.ContainsKey((byte)_effectValue.value2)
             && target.ActorInfo.status4012[(byte)_effectValue.value2] > 0)
            {
                _aAtkSkillPer += _effectValue.value1;
 
#if UNITY_EDITOR
                if (RuntimeLogUtility.s_SkillEffectLog)
                {
                    Debug.LogFormat("技能 {0} 触发了效果 {1} , _aAtkSkillPer 增加了 {2}", skillInfo.config.SkillID, 4015, _effectValue.value1);
                }
#endif
            }
        }
 
        // 4024 攻击附加真实伤害百分比
        if (skillInfo.effectValue.TryGetValue(4024, out _effectValue))
        {
            _aIceAtk *= (int)((10000 + _effectValue.value1) * Constants.F_DELTA);
 
#if UNITY_EDITOR
            if (RuntimeLogUtility.s_SkillEffectLog)
            {
                Debug.LogFormat("技能 {0} 触发了效果 {1} , _aIceAtk 增加了 {2}", skillInfo.config.SkillID, 4024, _aIceAtk * _effectValue.value1 * Constants.F_DELTA);
            }
#endif
        }
 
        // 4025 攻击附加真实伤害
        if (skillInfo.effectValue.TryGetValue(4025, out _effectValue))
        {
            _aIceAtk += _effectValue.value1;
 
#if UNITY_EDITOR
            if (RuntimeLogUtility.s_SkillEffectLog)
            {
                Debug.LogFormat("技能 {0} 触发了效果 {1} , _aIceAtk 增加了 {2}", skillInfo.config.SkillID, 4025, _effectValue.value1);
            }
#endif
        }
 
        // 4501 buff中攻击附加技能伤害
        if (StatusMgr.Instance.TryGetSkillEffectValue(attacker.ServerInstID, 4501, out _effectValue))
        {
            int _rate = _effectValue.value2;
            SkillHelper.EffectValue _rateEffectValue;
            // 判断是否存在4030 有的话提高概率
            if (StatusMgr.Instance.TryGetSkillEffectValue(attacker.ServerInstID, 4030, out _rateEffectValue))
            {
                _rate += _rateEffectValue.value1;
#if UNITY_EDITOR
                if (RuntimeLogUtility.s_SkillEffectLog)
                {
                    Debug.LogFormat("技能 {0} 触发了效果 {1} , 增加了 4501 的概率", skillInfo.config.SkillID, 4030, _rateEffectValue.value1);
                }
#endif
            }
 
            if (Random.Range(0, 10000) < _rate)
            {
                _aAtkSkillPer += _effectValue.value1;
 
#if UNITY_EDITOR
                if (RuntimeLogUtility.s_SkillEffectLog)
                {
                    Debug.LogFormat("技能 {0} 触发了效果 {1} , _aAtkSkillPer 增加了 {2}", skillInfo.config.SkillID, 4501, _effectValue.value1);
                }
#endif
            }
        }
 
        // 4503 buff中攻击提高增加伤害,可附加目标处于XX状态
        if (StatusMgr.Instance.TryGetSkillEffectValue(attacker.ServerInstID, 4503, out _effectValue))
        {
            if (target.ActorInfo.status4012.ContainsKey((byte)_effectValue.value2)
             && target.ActorInfo.status4012[(byte)_effectValue.value2] > 0)
            {
                _aDamagePer += _effectValue.value1;
 
#if UNITY_EDITOR
                if (RuntimeLogUtility.s_SkillEffectLog)
                {
                    Debug.LogFormat("技能 {0} 触发了效果 {1} , _aDamagePer 增加了 {2}", skillInfo.config.SkillID, 4503, _effectValue.value1);
                }
#endif
            }
        }
 
        // 4511 buff中攻击造成坐骑攻击属性XX%的额外伤害
        if (StatusMgr.Instance.TryGetSkillEffectValue(attacker.ServerInstID, 4511, out _effectValue))
        {
            MountModel _mountData = Snxxz.UI.ModelCenter.Instance.GetModel<MountModel>();
            int _allMountAtk = _mountData.GetAllMountAttack();
            _allMountAtk = (int)(_effectValue.value1 * Constants.F_DELTA * _allMountAtk);
            _aFinalHurt += _allMountAtk;
#if UNITY_EDITOR
            if (RuntimeLogUtility.s_SkillEffectLog)
            {
                Debug.LogFormat("技能 {0} 触发了效果 {1} , _aFinalHurt 增加了 {2}", skillInfo.config.SkillID, 4511, _allMountAtk);
            }
#endif
        }
 
        #endregion
 
        #region 暴击伤害增加
 
        // 4007 暴击时增加暴击值, 增加暴击值万分率, 虚要判断自己身上是否有配置的buff
        if (skillInfo.effectValue.TryGetValue(4007, out _effectValue))
        {
            bool _condition = true;
 
            // 判断buff
            if (_effectValue.value2 != 0)
            {
                if (!StatusMgr.Instance.IsExist(attacker.ServerInstID, _effectValue.value2))
                {
                    _condition = false;
                }
            }
 
            // 是否可以执行
            if (_condition && _isCrit)
            {
                _aSuperHit += (_aSuperHit * _effectValue.value1 * Constants.F_DELTA);
 
#if UNITY_EDITOR
                if (RuntimeLogUtility.s_SkillEffectLog)
                {
                    Debug.LogFormat("技能 {0} 触发了效果 {1} , _aSuperHit 增加了 {2}", skillInfo.config.SkillID, 4007, (_aSuperHit * _effectValue.value1 * Constants.F_DELTA));
                }
#endif
            }
        }
 
        #endregion
    }
 
    public static bool CheckHitEffect(GActorFight attacker, GActorFight target, int skillID)
    {
        if (PreFightMission.Instance.faBaoSkillShow
         && target.ActorType == GameObjType.gotNPC)
        {
            return false;
        }
 
        if (target.ActorInfo.RealHp == 0)
        {
            return false;
        }
 
        if (attacker is GA_Pet
         || target is GA_NpcFightSgzcZZ)
        {
            return false;
        }
 
        GActorNpcFight _fightNpc = null;
        // 目标是玩家
        if (target.ActorType == GameObjType.gotPlayer)
        {
            GActorPlayerBase _player = target as GActorPlayerBase;
 
            if (!_player.CanHurted())
            {
                return false;
            }
 
            // 攻击者是玩家
            if (attacker.ActorType == GameObjType.gotPlayer)
            {
                // 默认没有任何反馈
                return false;
            }
            // 攻击者是NPC
            else if (attacker.ActorType == GameObjType.gotNPC)
            {
                // 这里为前期战斗的判断
                if (!PreFightMission.Instance.IsFinished())
                {
                    _fightNpc = attacker as GActorNpcFight;
                    if (_fightNpc.NpcConfig.NPCID == 1007
                     && skillID != 10027)
                    {
                        return true;
                    }
                }
 
                // 1 目标无任何反馈
                // 2 目标有被击特效
                // 3 目标有被击特效及动作
                Skill _skill = attacker.SkillMgr.Get(skillID);
 
                // 根据配置, 如果释放的是冲锋技能, 默认都可以打断
                if (_skill != null
                 && !_skill.skillInfo.effectValue.ContainsKey(2100))
                {
                    _fightNpc = attacker as GActorNpcFight;
                    if (_fightNpc != null)
                    {
                        // 如果配置无反馈
                        if (_fightNpc.NpcConfig == null
                         || _fightNpc.NpcConfig.AtkFeedback < 3)
                        {
                            return false;
                        }
 
                        bool _IsSkillCantStop = true;
                        // 判断对象是否正在释放不可以被中断的技能
                        Skill _currentSkill = target.SkillMgr.CurCastSkill;
                        if (_currentSkill != null && _currentSkill.SkillCompelete == false)
                        {
                            if (!_player.CanSkillInterrupt(_currentSkill.id)
                             || _player.NextAction == _currentSkill.skillInfo.config.Skillactmark)
                            {
                                _IsSkillCantStop = false;
                            }
                        }
 
                        // 如果目标正在释放技能且非普攻, 不能打断
                        if (target.IsIdle() == false
                         && target.IsRun() == false
                         && target.IsHurt() == false
                         && _IsSkillCantStop)
                        {
                            return false;
                        }
                    }
                }
            }
        }
        else if (target.ActorType == GameObjType.gotNPC)
        {
            // 1 有被击动作
            // 2 无被击动作
            _fightNpc = target as GActorNpcFight;
            if (_fightNpc != null)
            {
                if (_fightNpc.NpcConfig.NPCType == (int)E_NpcType.BreakableObj)
                {
                    return false;
                }
 
                if (_fightNpc.NpcConfig == null
                 || _fightNpc.NpcConfig.hurtFeedback == 2)
                {
                    return false;
                }
 
                if (!_fightNpc.CanHurted())
                {
                    return false;
                }
            }
 
        }
 
        return true;
    }
 
    public static bool CheckPull(GActorFight attacker,
                                 GActorFight target,
                                 int bodyControlID)
    {
        if (PreFightMission.Instance.faBaoSkillShow
         && target.ActorType == GameObjType.gotNPC)
        {
            return false;
        }
 
        if (target is GA_NpcFightSgzcZZ)
        {
            return false;
        }
 
        if (attacker is GA_Pet
         || attacker is GA_NpcSummonFight)
        {
            return false;
        }
 
        if (bodyControlID == -1)
        {
            return false;
        }
 
        // 目标已经客户端死亡
        if (target.ActorInfo.RealHp == 0)
        {
            return false;
        }
 
        // 判断身体控制是否有配置,且配置的方式是否为可以推
        SoBodyControl _bodyControl = ScriptableObjectLoader.LoadSoBodyControl(bodyControlID);
 
        if (_bodyControl == null
         || _bodyControl.duration == 0)
        {
            return false;
        }
 
        // 目标是玩家
        if (target.ActorType == GameObjType.gotPlayer)
        {
            // 攻击者是玩家
            if (attacker.ActorType == GameObjType.gotPlayer)
            {
                return _bodyControl.useForPlayer && target.CanPushedBack();
            }
            else if (attacker.ActorType == GameObjType.gotNPC)
            {
                GActorNpcFight _npc = attacker as GActorNpcFight;
 
                if (_npc == null)
                {
                    return false;
                }
 
                // 这里为前期战斗的判断
                if (!PreFightMission.Instance.IsFinished())
                {
                    if (_npc.NpcConfig.NPCID == 1007)
                    {
                        return true;
                    }
                }
 
                if (_npc.NpcConfig == null
                 || _npc.NpcConfig.AtkFeedback < 3)
                {
                    return false;
                }
 
                if (!target.CanPushedBack())
                {
                    return false;
                }
            }
        }
        // 目标是npc怪物
        else if (target.ActorType == GameObjType.gotNPC)
        {
            // 1 有被击动作
            // 2 无被击动作
            if (!target.CanPushedBack())
            {
                return false;
            }
        }
 
        return true;
    }
 
    public struct HurtObjs
    {
        public byte ObjType;
        public uint ObjID;
        public uint clientInstID;
        public byte AttackType;
        public uint HurtHP;
        public ulong CurHP;
        public uint CurHPEx;
    }
 
    public static bool CanAttack(E_SkillCastTarget castTarget, GActorFight caster, GActorFight target)
    {
        if (target == null || caster == null || caster.ActorInfo.serverDie)
        {
            return false;
        }
 
        switch (castTarget)
        {
            case E_SkillCastTarget.None:
                return false;
            case E_SkillCastTarget.Self:
                return target == caster;
            case E_SkillCastTarget.TeamMate:
                return target.ActorInfo.teamID == caster.ActorInfo.teamID;
            case E_SkillCastTarget.Friend:
                break;
            case E_SkillCastTarget.CanAttacked:
                return target.CanAtked();
            case E_SkillCastTarget.SelfAndFriend:
                return target == caster;
            case E_SkillCastTarget.PlayerDeadBody:
                return target.ActorInfo.serverDie && target is GActorPlayerBase;
            case E_SkillCastTarget.UnDeadPlayer:
                return !target.ActorInfo.serverDie && target is GActorPlayerBase;
            case E_SkillCastTarget.CanAttackedMonster:
                return target is GA_NpcFightNorm && target.CanAtked();
            case E_SkillCastTarget.CanAttackedPlayer:
                return target is GActorPlayerBase && target.CanAtked();
            case E_SkillCastTarget.All:
                return true;
            case E_SkillCastTarget.PetToOwner:
                return target.ActorInfo.ownerSID == caster.ServerInstID && caster is GA_Pet;
            case E_SkillCastTarget.SummonToOwner:
                return target.ActorInfo.ownerSID == caster.ServerInstID && caster is GA_NpcSummonFight;
            case E_SkillCastTarget.Monster:
                var _npc = target as GActorNpcFight;
                if (_npc == null)
                {
                    return false;
                }
                return _npc.NpcConfig.IsBoss < 2;
            case E_SkillCastTarget.FriendNpc:
                return (target is GActorNpcFight && target.ActorInfo.faction != 0 && target.ActorInfo.faction == PlayerDatas.Instance.baseData.faction);
        }
        return true;
    }
}