From bfa20b35bbe0407a93a0eb96d53463413d61504c Mon Sep 17 00:00:00 2001
From: yyl <yyl>
Date: 星期五, 31 十月 2025 16:13:19 +0800
Subject: [PATCH] 125 战斗 误传的断点
---
Main/System/Battle/Skill/SkillBase.cs | 259 ++++++++++++++++++++++++++++++++++++++++-----------
1 files changed, 200 insertions(+), 59 deletions(-)
diff --git a/Main/System/Battle/Skill/SkillBase.cs b/Main/System/Battle/Skill/SkillBase.cs
index 639bde7..1bfa376 100644
--- a/Main/System/Battle/Skill/SkillBase.cs
+++ b/Main/System/Battle/Skill/SkillBase.cs
@@ -9,6 +9,13 @@
{
const float moveTime = 0.5f;
+ private static readonly Color colorGreen = new Color(33f / 255f,
+ 133f / 255f,
+ 6f / 255f);
+ private static readonly Color colorBlue = new Color(40f / 255f,
+ 87f / 255f,
+ 189f / 255f);
+
protected SkillEffect skillEffect;
protected HB427_tagSCUseSkill tagUseSkillAttack;
public SkillConfig skillConfig;
@@ -24,8 +31,13 @@
public int fromSkillId;
public bool isPlay = false;
+ private float MoveSpeed = 750f;
+
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)
@@ -76,6 +88,44 @@
}
}
+ protected void ShadowIllutionCreate(bool create)
+ {
+ if (create)
+ {
+ Color color = Color.white;
+ //1-杩炲嚮锛�2-鍙嶅嚮锛�3-杩藉嚮
+ // 鍙嶅嚮钃濊壊
+ // 杩藉嚮杩炲嚮缁胯壊
+ bool change = false;
+ if (tagUseSkillAttack.BattleType == 1)
+ {
+ color = colorGreen;
+ change = true;
+ }
+ else if (tagUseSkillAttack.BattleType == 2)
+ {
+ color = colorBlue;
+ change = true;
+ }
+ else if (tagUseSkillAttack.BattleType == 3)
+ {
+ color = colorGreen;
+ change = true;
+ }
+
+ if (change)
+ {
+ MoveSpeed = 1125f;
+ caster.motionBase.ShowIllusionShadow(true, color);
+ }
+ }
+ else
+ {
+ MoveSpeed = 750f;
+ caster.motionBase.ShowIllusionShadow(false);
+ }
+ }
+
// 鎶�鑳介噴鏀句富閫昏緫锛氬箍鎾簨浠躲�侀珮浜洰鏍囥�佹墽琛岄噴鏀�
public virtual void Cast()
{
@@ -84,12 +134,37 @@
TeamHero teamHero = caster.teamHero;
EventBroadcast.Instance.Broadcast<string, SkillConfig, TeamHero>(EventName.BATTLE_CAST_SKILL, guid, skillConfig, teamHero);
+ if (caster != null)
+ {
+ // 鎴樻枟绫诲瀷 0-甯歌锛�1-杩炲嚮锛�2-鍙嶅嚮锛�3-杩藉嚮锛�4-瀛愭妧鑳斤紱5-琚姩瑙﹀彂鐨�
+ DamageNumConfig hintConfig = null;
+ if (tagUseSkillAttack.BattleType == 1)
+ {
+ hintConfig = DamageNumConfig.Get(BattleConst.BattleComboAttack);
+ }
+ else if (tagUseSkillAttack.BattleType == 2)
+ {
+ hintConfig = DamageNumConfig.Get(BattleConst.BattleCounterAttack);
+ }
+ else if (tagUseSkillAttack.BattleType == 3)
+ {
+ hintConfig = DamageNumConfig.Get(BattleConst.BattleChaseAttack);
+ }
+
+ if (hintConfig != null)
+ {
+ caster.heroInfoBar.ShowTips(((char)hintConfig.prefix).ToString(), true, false, 1.25f);
+ // Debug.Break();
+ }
+ }
+
// 楂樹寒鎵�鏈夋湰娆℃妧鑳界浉鍏崇殑鐩爣
HighLightAllTargets();
// 鏍规嵁閲婃斁妯″紡鎵ц鐩稿簲閫昏緫
switch (skillConfig.castMode)
{
+ case SkillCastMode.None:
case SkillCastMode.Self:
CastImpl(OnAttackFinish);
break;
@@ -125,7 +200,12 @@
RectTransform target = battleField.GetTeamNode(caster.GetEnemyCamp(), skillConfig);
ExecuteMoveAndCastSequence(target, () =>
{
- MoveToTarget(battleField.GetTeamNode(caster.Camp, caster.teamHero.positionNum), Vector2.zero, OnAttackFinish, 750F);
+ // ShadowIllutionCreate(true);
+ MoveToTarget(battleField.GetTeamNode(caster.Camp, caster.teamHero.positionNum), Vector2.zero, () =>
+ {
+ // ShadowIllutionCreate(false);
+ OnAttackFinish();
+ }, MoveSpeed);
});
}
@@ -146,7 +226,12 @@
ExecuteMoveAndCastSequence(targetTrans, () =>
{
RectTransform rectTransform = battleField.GetTeamNode(caster.Camp, caster.teamHero.positionNum);
- MoveToTarget(rectTransform, Vector2.zero, OnAttackFinish, 750F);
+ // ShadowIllutionCreate(true);
+ MoveToTarget(rectTransform, Vector2.zero, () =>
+ {
+ // ShadowIllutionCreate(false);
+ OnAttackFinish();
+ }, MoveSpeed);
});
}
@@ -156,17 +241,24 @@
RectTransform target = battleField.GetTeamNode(caster.Camp, skillConfig);
ExecuteMoveAndCastSequence(target, () =>
{
- MoveToTarget(battleField.GetTeamNode(caster.Camp, caster.teamHero.positionNum), Vector2.zero, OnAttackFinish, 750F);
+ // ShadowIllutionCreate(true);
+ MoveToTarget(battleField.GetTeamNode(caster.Camp, caster.teamHero.positionNum), Vector2.zero, () =>
+ {
+ // ShadowIllutionCreate(false);
+ OnAttackFinish();
+ }, MoveSpeed);
});
}
// 鎵ц绉诲姩-鏂芥硶-杩斿洖搴忓垪锛氶�氱敤鐨勭Щ鍔ㄦ敾鍑绘祦绋�
private void ExecuteMoveAndCastSequence(RectTransform target, Action onReturnComplete)
{
+ ShadowIllutionCreate(true);
MoveToTarget(target, new Vector2(skillConfig.CastDistance, 0), () =>
{
TurnBack(() =>
{
+ ShadowIllutionCreate(false);
CastImpl(() =>
{
TurnBack(() =>
@@ -187,7 +279,7 @@
}
// 绉诲姩鍒扮洰鏍囦綅缃細澶勭悊瑙掕壊鐨勭Щ鍔ㄥ姩鐢诲拰閫昏緫
- protected void MoveToTarget(RectTransform target, Vector2 offset, Action _onComplete = null, float speed = 500f)
+ protected void MoveToTarget(RectTransform target, Vector2 offset, Action _onComplete = null, float speed = 750f)
{
if (skillConfig.CastDistance >= 9999)
{
@@ -251,7 +343,8 @@
skillEffect.Play(OnHitTargets);
foreach (var subSkillPack in tagUseSkillAttack.subSkillList)
{
- RecordAction recordAction = CustomHB426CombinePack.CreateSkillAction(battleField.guid, new List<GameNetPackBasic>() { subSkillPack });
+ SkillRecordAction recordAction = CustomHB426CombinePack.CreateSkillAction(battleField.guid, new List<GameNetPackBasic>() { subSkillPack });
+ otherSkillActionList.Add(recordAction);
battleField.recordPlayer.ImmediatelyPlay(recordAction);
}
isPlay = true;
@@ -320,7 +413,7 @@
}
battleField.battleRootNode.skillMaskNode.SetActive(true);
- battleField.battleRootNode.SetSortingOrder();
+ // battleField.battleRootNode.SetSortingOrder();
}
// 鍛戒腑鐩爣鍥炶皟锛氬鐞嗘墍鏈夎鍛戒腑鐨勭洰鏍�
@@ -621,71 +714,119 @@
public void OnSkillFinished()
{
// 淇锛氫娇鐢ㄥ惊鐜唬鏇块�掑綊锛岄伩鍏嶆爤婧㈠嚭椋庨櫓
- try
+ // 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--)
- {
- var action = otherSkillActionList[i];
- if (action.IsFinished())
- {
- otherSkillActionList.RemoveAt(i);
- hasFinishedAction = true;
- }
- }
- if (hasFinishedAction)
- {
- continue; // 浣跨敤continue浠f浛閫掑綊璋冪敤
- }
- return;
- }
-
- break; // 娌℃湁鏇村闇�瑕佸鐞嗙殑锛岄��鍑哄惊鐜�
+ skillEffect = null;
+ continue; // 浣跨敤continue浠f浛閫掑綊璋冪敤
}
- // 澶勭悊鍓╀綑鍖�
- while (packList.Count > 0)
+ // 楠岃瘉鍏朵粬鎶�鑳藉姩浣滄槸鍚﹀畬鎴�
+ if (otherSkillActionList.Count > 0)
{
- var pack = packList[0];
- packList.RemoveAt(0);
-
- if (pack is CustomHB426CombinePack combinePack && combinePack.startTag.Tag.StartsWith("Skill_"))
+ bool hasFinishedAction = false;
+ for (int i = otherSkillActionList.Count - 1; i >= 0; i--)
{
- BattleDebug.LogError("other skill casting " + combinePack.startTag.Tag);
- var otherSkillAction = combinePack.CreateSkillAction();
- otherSkillAction.fromSkillId = skillConfig.SkillID;
- return;
+ var action = otherSkillActionList[i];
+ if (action.IsFinished())
+ {
+ otherSkillActionList.RemoveAt(i);
+ hasFinishedAction = true;
+ }
+ }
+ if (hasFinishedAction)
+ {
+ continue; // 浣跨敤continue浠f浛閫掑綊璋冪敤
+ }
+ return;
+ }
+
+ break; // 娌℃湁鏇村闇�瑕佸鐞嗙殑锛岄��鍑哄惊鐜�
+ }
+
+ // 澶勭悊鍓╀綑鍖�
+ 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;
+ }
}
- if (pack is CustomB421ActionPack actionPack)
- actionPack.Distribute();
+ // 鍚屾椂鍒锋柊鎵�鏈夊璞$殑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);
}
}
- catch (Exception ex)
- {
- Debug.LogError($"OnSkillFinished寮傚父: {ex.Message}锛屾妧鑳絀D={skillConfig.SkillID}");
- // 纭繚鐘舵�佷竴鑷存�э紝鍗充娇鍑虹幇寮傚父涔熻鏍囪瀹屾垚
- isFinished = true;
- throw; // 閲嶆柊鎶涘嚭寮傚父渚涗笂灞傚鐞�
- }
- isFinished = true;
+ return true;
}
// 娣诲姞娓呯悊鏂规硶锛氶槻姝㈠唴瀛樻硠婕�
--
Gitblit v1.8.0