From d591b5c972cdd4f290e114bc08ef443a051aecad Mon Sep 17 00:00:00 2001
From: yyl <yyl>
Date: 星期五, 31 十月 2025 14:14:27 +0800
Subject: [PATCH] 125 战斗 buff合并展示
---
Main/System/Battle/Skill/SkillBase.cs | 165 +++++++++++++++++++++++++++++++++++--------------------
1 files changed, 105 insertions(+), 60 deletions(-)
diff --git a/Main/System/Battle/Skill/SkillBase.cs b/Main/System/Battle/Skill/SkillBase.cs
index b8c46b5..0b9f285 100644
--- a/Main/System/Battle/Skill/SkillBase.cs
+++ b/Main/System/Battle/Skill/SkillBase.cs
@@ -36,6 +36,9 @@
private Dictionary<int, BattleDrops> tempDropList = new Dictionary<int, BattleDrops>();
private Dictionary<int, HB422_tagMCTurnFightObjDead> tempDeadPackList = new Dictionary<int, HB422_tagMCTurnFightObjDead>();
+ protected List<HB428_tagSCBuffRefresh> buffCollections = new List<HB428_tagSCBuffRefresh>();
+
+
// 鏋勯�犲嚱鏁帮細鍒濆鍖栨妧鑳藉熀纭�鏁版嵁
public SkillBase(BattleObject _caster, SkillConfig _skillCfg, HB427_tagSCUseSkill vNetData, List<GameNetPackBasic> _packList, BattleField _battleField = null)
{
@@ -712,76 +715,118 @@
// 淇锛氫娇鐢ㄥ惊鐜唬鏇块�掑綊锛岄伩鍏嶆爤婧㈠嚭椋庨櫓
// try
// {
- while (true)
+ while (true)
+ {
+ // 楠岃瘉鎶�鑳芥晥鏋滄槸鍚﹀畬鎴�
+ if (skillEffect != null && !skillEffect.IsFinished())
+ return;
+
+ if (skillEffect != null)
{
- // 楠岃瘉鎶�鑳芥晥鏋滄槸鍚﹀畬鎴�
- if (skillEffect != null && !skillEffect.IsFinished())
- return;
-
- if (skillEffect != null)
+ skillEffect = null;
+ continue; // 浣跨敤continue浠f浛閫掑綊璋冪敤
+ }
+
+ // 楠岃瘉鍏朵粬鎶�鑳藉姩浣滄槸鍚﹀畬鎴�
+ if (otherSkillActionList.Count > 0)
+ {
+ bool hasFinishedAction = false;
+ for (int i = otherSkillActionList.Count - 1; i >= 0; i--)
{
- skillEffect = null;
+ var action = otherSkillActionList[i];
+ if (action.IsFinished())
+ {
+ otherSkillActionList.RemoveAt(i);
+ hasFinishedAction = true;
+ }
+ }
+ if (hasFinishedAction)
+ {
continue; // 浣跨敤continue浠f浛閫掑綊璋冪敤
}
-
- // 楠岃瘉鍏朵粬鎶�鑳藉姩浣滄槸鍚﹀畬鎴�
- if (otherSkillActionList.Count > 0)
- {
- bool hasFinishedAction = false;
- for (int i = otherSkillActionList.Count - 1; i >= 0; i--)
- {
- var action = otherSkillActionList[i];
- if (action.IsFinished())
- {
- otherSkillActionList.RemoveAt(i);
- hasFinishedAction = true;
- }
- }
- if (hasFinishedAction)
- {
- continue; // 浣跨敤continue浠f浛閫掑綊璋冪敤
- }
- return;
- }
-
- break; // 娌℃湁鏇村闇�瑕佸鐞嗙殑锛岄��鍑哄惊鐜�
+ return;
}
- // 澶勭悊鍓╀綑鍖�
- while (packList.Count > 0)
- {
- var pack = packList[0];
- packList.RemoveAt(0);
+ break; // 娌℃湁鏇村闇�瑕佸鐞嗙殑锛岄��鍑哄惊鐜�
+ }
- if (pack is CustomHB426CombinePack combinePack && combinePack.startTag.Tag.StartsWith("Skill_"))
- {
- BattleDebug.LogError("other skill casting " + combinePack.startTag.Tag);
- var otherSkillAction = combinePack.CreateSkillAction();
- otherSkillAction.fromSkillId = skillConfig.SkillID;
- otherSkillActionList.Add(otherSkillAction);
- return;
- }
-
- if (pack is CustomB421ActionPack actionPack)
- {
- actionPack.Distribute();
- }
- else
- {
- PackageRegedit.Distribute(pack);
- }
- }
- // }
- // catch (Exception ex)
- // {
- // Debug.LogError($"OnSkillFinished寮傚父: {ex.Message}锛屾妧鑳絀D={skillConfig.SkillID}");
- // // 纭繚鐘舵�佷竴鑷存�э紝鍗充娇鍑虹幇寮傚父涔熻鏍囪瀹屾垚
- // isFinished = true;
- // throw; // 閲嶆柊鎶涘嚭寮傚父渚涗笂灞傚鐞�
- // }
+ // 澶勭悊鍓╀綑鍖�
+ if (!ResolvePackList())
+ {
+ return;
+ }
+ // }
+ // catch (Exception ex)
+ // {
+ // Debug.LogError($"OnSkillFinished寮傚父: {ex.Message}锛屾妧鑳絀D={skillConfig.SkillID}");
+ // // 纭繚鐘舵�佷竴鑷存�э紝鍗充娇鍑虹幇寮傚父涔熻鏍囪瀹屾垚
+ // isFinished = true;
+ // throw; // 閲嶆柊鎶涘嚭寮傚父渚涗笂灞傚鐞�
+ // }
isFinished = true;
}
+
+ protected virtual bool ResolvePackList()
+ {
+ while (packList.Count > 0)
+ {
+ var pack = packList[0];
+ packList.RemoveAt(0);
+
+ if (pack is CustomHB426CombinePack combinePack && combinePack.startTag.Tag.StartsWith("Skill_"))
+ {
+ BattleDebug.LogError("other skill casting " + combinePack.startTag.Tag);
+ var otherSkillAction = combinePack.CreateSkillAction();
+ otherSkillAction.fromSkillId = skillConfig.SkillID;
+ otherSkillActionList.Add(otherSkillAction);
+ return false;
+ }
+ else if (pack is HB428_tagSCBuffRefresh buffRefresh)
+ {
+ // 浠庢壘鍒扮涓�涓狧B428寮�濮� 鎵惧嚭杩炵画鐨凥B428_tagSCBuffRefresh鍖� 濡傛灉鎵惧埌涓�涓狟428鍚� 涔嬪悗纰板埌闈濰B428鍖呭氨鍋滄
+ buffCollections.Add(buffRefresh);
+ while (packList.Count > 0)
+ {
+ var nextPack = packList[0];
+ if (nextPack is HB428_tagSCBuffRefresh nextBuffRefresh)
+ {
+ buffCollections.Add(nextBuffRefresh);
+ packList.RemoveAt(0);
+ }
+ else
+ {
+ break;
+ }
+ }
+
+ // 鍚屾椂鍒锋柊鎵�鏈夊璞$殑buff锛屼笉鍒嗙粍
+ foreach (var buff in buffCollections)
+ {
+ BattleObject battleObj = battleField.battleObjMgr.GetBattleObject((int)buff.ObjID);
+ if (battleObj != null)
+ {
+ battleObj.buffMgr.RefreshBuff(buff, true);
+ }
+ }
+
+ // 娓呯┖宸插鐞嗙殑buff闆嗗悎
+ buffCollections.Clear();
+ continue;
+ }
+
+ if (pack is CustomB421ActionPack actionPack)
+ {
+ actionPack.Distribute();
+ }
+ else
+ {
+ PackageRegedit.Distribute(pack);
+ }
+ }
+
+ return true;
+ }
// 娣诲姞娓呯悊鏂规硶锛氶槻姝㈠唴瀛樻硠婕�
public virtual void Cleanup()
--
Gitblit v1.8.0