yyl
2025-08-29 5909666c81bd9a14a88d79d9f27229b1f14d2e55
125
【战斗】战斗系统
7个文件已修改
177 ■■■■ 已修改文件
Main/Config/Configs/SkillConfig.cs 74 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Main/Config/PartialConfigs/SkillConfig.Partial.cs 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Main/Core/NetworkPackage/DTCFile/ServerPack/HB4_FightDefine/DTCB424_tagSCTurnFightInit.cs 58 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Main/Core/NetworkPackage/DTCFile/ServerPack/HB4_FightDefine/DTCB428_tagSCBuffRefresh.cs 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Main/System/Battle/BattleField/RecordActions/SkillRecordAction.cs 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Main/System/Battle/BattleManager.cs 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Main/System/Battle/Skill/SkillFactory.cs 21 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Main/Config/Configs/SkillConfig.cs
@@ -1,6 +1,6 @@
//--------------------------------------------------------
//    [Author]:           YYL
//    [  Date ]:           2025年8月26日
//    [  Date ]:           2025年8月29日
//--------------------------------------------------------
using System.Collections.Generic;
@@ -38,7 +38,6 @@
    public int EffectID3;
    public int[] EffectValues3;
    public int CoolDownTime;
    public int[] EnhanceSkillList;
    public int FightPower;
    public string SkillMotionName;
    public string IconName;
@@ -59,6 +58,7 @@
    public int EffectId;
    public int EffectId2;
    public int MStartEffectId;
    public int TriggerEffect;
    public override int LoadKey(string _key)
    {
@@ -150,37 +150,23 @@
            int.TryParse(tables[21],out CoolDownTime); 
            if (tables[22].Contains("["))
            int.TryParse(tables[22],out FightPower);
            SkillMotionName = tables[23];
            IconName = tables[24];
            int.TryParse(tables[25],out EffectType);
            int.TryParse(tables[26],out StartupFrames);
            if (tables[27].Contains("["))
            {
                EnhanceSkillList = JsonMapper.ToObject<int[]>(tables[22]);
                ActiveFrames = JsonMapper.ToObject<int[]>(tables[27]);
            }
            else
            {
                string[] EnhanceSkillListStringArray = tables[22].Trim().Split(StringUtility.splitSeparator,StringSplitOptions.RemoveEmptyEntries);
                EnhanceSkillList = new int[EnhanceSkillListStringArray.Length];
                for (int i=0;i<EnhanceSkillListStringArray.Length;i++)
                {
                     int.TryParse(EnhanceSkillListStringArray[i],out EnhanceSkillList[i]);
                }
            }
            int.TryParse(tables[23],out FightPower);
            SkillMotionName = tables[24];
            IconName = tables[25];
            int.TryParse(tables[26],out EffectType);
            int.TryParse(tables[27],out StartupFrames);
            if (tables[28].Contains("["))
            {
                ActiveFrames = JsonMapper.ToObject<int[]>(tables[28]);
            }
            else
            {
                string[] ActiveFramesStringArray = tables[28].Trim().Split(StringUtility.splitSeparator,StringSplitOptions.RemoveEmptyEntries);
                string[] ActiveFramesStringArray = tables[27].Trim().Split(StringUtility.splitSeparator,StringSplitOptions.RemoveEmptyEntries);
                ActiveFrames = new int[ActiveFramesStringArray.Length];
                for (int i=0;i<ActiveFramesStringArray.Length;i++)
                {
@@ -188,33 +174,35 @@
                }
            }
            int.TryParse(tables[29],out RecoveryFrames);
            int.TryParse(tables[28],out RecoveryFrames);
            int.TryParse(tables[30],out LoopCount);
            int.TryParse(tables[29],out LoopCount);
            int.TryParse(tables[31],out CastPosition);
            int.TryParse(tables[30],out CastPosition);
            int.TryParse(tables[32],out CastIndexNum);
            int.TryParse(tables[31],out CastIndexNum);
            float.TryParse(tables[33],out CastDistance);
            float.TryParse(tables[32],out CastDistance);
            DamageDivide = JsonMapper.ToObject<int[][]>(tables[34].Replace("(", "[").Replace(")", "]"));
            DamageDivide = JsonMapper.ToObject<int[][]>(tables[33].Replace("(", "[").Replace(")", "]"));
            int.TryParse(tables[35],out BulletEffectId);
            int.TryParse(tables[34],out BulletEffectId);
            int.TryParse(tables[36],out BulletPath);
            int.TryParse(tables[35],out BulletPath);
            float.TryParse(tables[37],out BulletFlyTime);
            float.TryParse(tables[36],out BulletFlyTime);
            int.TryParse(tables[38],out ExplosionEffectId);
            int.TryParse(tables[37],out ExplosionEffectId);
            int.TryParse(tables[39],out ExplosionEffect2);
            int.TryParse(tables[38],out ExplosionEffect2);
            int.TryParse(tables[40],out EffectId);
            int.TryParse(tables[39],out EffectId);
            int.TryParse(tables[41],out EffectId2);
            int.TryParse(tables[40],out EffectId2);
            int.TryParse(tables[42],out MStartEffectId);
            int.TryParse(tables[41],out MStartEffectId);
            int.TryParse(tables[42],out TriggerEffect);
        }
        catch (Exception exception)
        {
Main/Config/PartialConfigs/SkillConfig.Partial.cs
@@ -24,6 +24,15 @@
        skillType = (SkillType)SkillType;
        castMode = (SkillCastMode)CastPosition;
        effectType = (SkillEffectType)EffectType;
// #if UNITY_EDITOR
//         if (Launch.Instance.isOpenBattleDebug)
//         {
//             if (castMode == SkillCastMode.None)
//             {
//                 castMode = SkillCastMode.Target;
//             }
//         }
// #endif
    }
    public MotionName GetMotionName()
Main/Core/NetworkPackage/DTCFile/ServerPack/HB4_FightDefine/DTCB424_tagSCTurnFightInit.cs
@@ -1,11 +1,67 @@
using UnityEngine;
using System.Collections;
using LitJson;
using System.Collections.Generic;
// B4 24 回合战斗初始化 #tagSCTurnFightInit
public class DTCB424_tagSCTurnFightInit : DtcBasic {
    public override void Done(GameNetPackBasic vNetPack) {
    public override void Done(GameNetPackBasic vNetPack)
    {
        base.Done(vNetPack);
        HB424_tagSCTurnFightInit vNetData = vNetPack as HB424_tagSCTurnFightInit;
        // 【战斗地图定义】
        // 前后端协议通讯时,如果有MapID、FuncLineID信息,一般代表的是某个战斗功能,
        // 并可绑定某个战斗场景(相当于MMO中的不同功能及战斗场景地图)
        // 卡牌中也可理解为不同的战斗功能及绑定不同的战斗背景图之类
        // 目前几个固定MapID定义
        // 主线小怪战斗 MapID = 1
        // FuncLineID = 章节*10000+关卡编号*100+第x波,如第一章,第10关卡,第5波时值 = 11005,
        // 单章最大支持99小关,单关最大支持99波怪
        // 主线boss战斗 MapID = 2
        // FuncLineID = 章节*10000+关卡编号*100+第x波,如第一章,第10关卡的boss值 = 11001,
        // 注:关卡boss波数固定为只有1波
        // 前端可通过MapID及对应的FuncLineID加载不同的战斗场景背景、背景音乐等
        // HB424_tagSCTurnFightInit
        // MapID;    // 自定义地图ID,可用于绑定战斗地图场景功能(如主线关卡、主线boss、爬塔、竞技场等)
        // FuncLineID;    // MapID对应的扩展值,如具体某个关卡等
        // TurnMax;    // 最大轮次
        // Len;
        // Msg;    // 本场战斗扩展信息,一般为json格式,具体内容由MapID决定
        // FactionCnt;
        // FactionList;    // 阵营列表,通常固定只有两个阵营
        List<TeamBase> redTeamList = new List<TeamBase>();
        List<TeamBase> blueTeamList = new List<TeamBase>();
        if (null != vNetData.FactionList)
        {
            foreach (var vFaction in vNetData.FactionList)
            {
                if (vFaction.Faction == 1)
                {
                    foreach (var lineUp in vFaction.LineupList)
                    {
                        redTeamList.Add(new TeamBase(lineUp));
                    }
                }
                else if (vFaction.Faction == 2)
                {
                    foreach (var lineUp in vFaction.LineupList)
                    {
                        blueTeamList.Add(new TeamBase(lineUp));
                    }
                }
            }
        }
        JsonData extendData = JsonMapper.ToObject(vNetData.Msg);
        string guid = BattleManager.Instance.GetGUID(vNetPack.packUID);
        BattleField battleField = BattleManager.Instance.CreateBattleField(guid, (int)vNetData.MapID, (int)vNetData.FuncLineID, extendData, redTeamList, blueTeamList);
        BattleStartAction battleStartAction = new BattleStartAction(battleField);
        battleField.recordPlayer.PlayRecord(battleStartAction);
    }
}
Main/Core/NetworkPackage/DTCFile/ServerPack/HB4_FightDefine/DTCB428_tagSCBuffRefresh.cs
@@ -7,5 +7,11 @@
    public override void Done(GameNetPackBasic vNetPack) {
        base.Done(vNetPack);
        HB428_tagSCBuffRefresh vNetData = vNetPack as HB428_tagSCBuffRefresh;
        BattleField battleField = BattleManager.Instance.GetBattleField(vNetData.packUID);
        if (null != battleField)
        {
            battleField.OnRefreshBuff(vNetData);
        }
    }
}
Main/System/Battle/BattleField/RecordActions/SkillRecordAction.cs
@@ -11,6 +11,7 @@
        : base(RecordActionType.Skill, _battleField, _caster)
    {
        skillBase = SkillFactory.CreateSkill(_caster, vNetData, packList, _battleField);
        BattleDebug.LogError("skill record action tpye : " + skillBase.GetType().Name);
    }
    public override bool IsFinished()
Main/System/Battle/BattleManager.cs
@@ -263,6 +263,7 @@
        if (!battlePackRelationList.TryGetValue(guid, out uidList))
        {
            uidList = new List<ulong>();
            battlePackRelationList.Add(guid, uidList);
        }
        uidList.Add(vNetPack.packUID);
@@ -387,10 +388,17 @@
    public void Run()
    {
        try
        {
        foreach (var battleField in battleFields)
        {
            battleField.Value?.Run();
        }
    }
        catch (System.Exception ex)
        {
            Debug.LogError(ex);
        }
    }
}
Main/System/Battle/Skill/SkillFactory.cs
@@ -41,9 +41,20 @@
    public static SkillBase CreateSkill(BattleObject _caster, HB427_tagSCUseSkill vNetData, List<GameNetPackBasic> packList, BattleField battleField)
    {
        SkillConfig skillConfig = SkillConfig.Get((int)vNetData.SkillID);
        if (null == skillConfig)
        {
            Debug.LogError("skill config is null id is " + vNetData.SkillID);
            return null;
        }
        Debug.LogError("skill type is " + skillConfig.SkillType + " skill id is " + vNetData.SkillID);
        SkillBase skill = null;
        switch (skillConfig.SkillType)
@@ -56,16 +67,14 @@
                // skill = new DirectlyHealSkill(_skillConfig);
                break;
            case 3:
                // skill = new SupportSkill(_skillConfig);
                break;
            case 4:
                // skill = new MountBuffSkill(_skillConfig);
                break;
            case 5:
                // skill = new ReviveSkill(_skillConfig);
            case 6:
            case 14:
                // skill = new MountBuffSkill(_caster, skillConfig, vNetData, packList, battleField);
                break;
            default:
                BattleDebug.LogError("超出了技能类型范围 请检查配置");
                Debug.LogError("超出了技能类型范围 请检查配置");
                break;
        }