From 09bc892c7283df8757a07b646d5af21ddaa263d1 Mon Sep 17 00:00:00 2001
From: lcy <1459594991@qq.com>
Date: 星期四, 06 十一月 2025 18:22:34 +0800
Subject: [PATCH] 164 天子的考验-客户端
---
Main/System/Battle/BattleObject/BattleObject.cs | 153 ++++++++++++++++++++++++++++++++++++--------------
1 files changed, 110 insertions(+), 43 deletions(-)
diff --git a/Main/System/Battle/BattleObject/BattleObject.cs b/Main/System/Battle/BattleObject/BattleObject.cs
index ba47e96..266ee05 100644
--- a/Main/System/Battle/BattleObject/BattleObject.cs
+++ b/Main/System/Battle/BattleObject/BattleObject.cs
@@ -48,7 +48,7 @@
private set;
}
- protected BattleDrops battleDrops;
+ protected BattleDrops m_battleDrops;
private RectTransform m_heroRectTrans;
@@ -86,6 +86,8 @@
motionBase.Init(heroGo.GetComponentInChildren<SkeletonAnimation>(true));
buffMgr = new BattleObjectBuffMgr();
buffMgr.Init(this);
+
+ buffMgr.onIsControlChanged += OnControledChange;
layerMgr = new BattleObjectLayerMgr();
layerMgr.Init(this);
@@ -127,6 +129,9 @@
motionBase.Release();
motionBase = null;
+ buffMgr.onIsControlChanged -= OnControledChange;
+ buffMgr.Release();
+ buffMgr = null;
teamHero = null;
ObjID = 0;
@@ -137,8 +142,30 @@
}
}
+ // 鏈夊彉鍖栦簡鎵嶄細璋冪敤杩欎釜鍑芥暟
+ private void OnControledChange(int groupType, bool value)
+ {
+ // 杩欓噷鏄彈鍒扮‖鎺ф椂鍊� 闇�瑕佽〃鐜扮殑鍔ㄧ敾
+ if (groupType == BattleConst.HardControlGroup)
+ {
+ // 浠庢病琚‖鎺у埌琚‖鎺�
+ if (value)
+ {
+ motionBase.SetControledAnimation();
+ }
+ else
+ {
+ motionBase.CancelControledAnimation();
+ }
+ }
+ }
+
public void OnObjInfoRefresh(H0418_tagObjInfoRefresh _refreshInfo)
{
+ // 澶╁瓙鐨勬寫鎴樻嫤鎴鏉¢�昏緫
+ BattleObject boss = battleField.FindBoss();
+ if (boss != null && battleField.MapID == 30020 && boss.ObjID == _refreshInfo.ObjID)
+ return;
switch ((PlayerDataType)_refreshInfo.RefreshType)
{
case PlayerDataType.HP:
@@ -163,6 +190,10 @@
public void ObjPropertyRefreshView(HB418_tagSCObjPropertyRefreshView vNetData)
{
+ // 澶╁瓙鐨勬寫鎴樻嫤鎴鏉¢�昏緫
+ BattleObject boss = battleField.FindBoss();
+ if (boss != null && battleField.MapID == 30020 && boss.ObjID == vNetData.ObjID)
+ return;
switch ((PlayerDataType)vNetData.RefreshType)
{
case PlayerDataType.HP:
@@ -268,33 +299,76 @@
return true;
}
- public virtual void Hurt(List<long> damageValues, long _totalDamage, HB427_tagSCUseSkill.tagSCUseSkillHurt hurt, SkillConfig skillConfig, bool playAnimation = true)
+ public virtual void Hurt(BattleHurtParam battleHurtParam)
{
- BattleDmgInfo dmgInfo = PopDamage(damageValues, _totalDamage, hurt, skillConfig);
+ bool isLastHit = battleHurtParam.hitIndex >= battleHurtParam.skillConfig.DamageDivide.Length - 1;
+ bool firstHit = battleHurtParam.hitIndex == 0;
+ BattleDmgInfo dmgInfo = PopDamage(battleHurtParam);
- if ((dmgInfo.IsType(DamageType.Damage) || dmgInfo.IsRealdamage()) && playAnimation)
+
+ // 杩欓噷
+ if (dmgInfo.IsType(DamageType.Dodge) && !buffMgr.isControled[BattleConst.HardControlGroup])
{
- motionBase.PlayAnimation(MotionName.hit, false);
+ if (isLastHit)
+ {
+ DodgeFinishAction dodgeFinish = new DodgeFinishAction(battleField, this);
+ battleField.recordPlayer.InsertRecord(dodgeFinish);
+ }
+
+ if (firstHit)
+ {
+ OnDodgeBegin();
+ }
+ }
+
+
+
+ bool isFatalAttack = (null != battleHurtParam.deadPack) && isLastHit;
+
+ if (isFatalAttack)
+ {
+ if (null != battleHurtParam.battleDrops)
+ {
+ PushDropItems(battleHurtParam.battleDrops);
+ }
+ battleField.OnObjsDead(new List<HB422_tagMCTurnFightObjDead>() { battleHurtParam.deadPack });
+
+ }
+ else
+ {
+ if (dmgInfo.IsType(DamageType.Block))
+ {
+ battleField.battleEffectMgr.PlayEffect(this, 19999, heroRectTrans, Camp);
+ }
+ else
+ {
+ if ((dmgInfo.IsType(DamageType.Damage) || dmgInfo.IsRealdamage()))
+ {
+ if (!buffMgr.isControled[BattleConst.HardControlGroup])
+ {
+ motionBase.PlayAnimation(MotionName.hit, false);
+ }
+ }
+ }
+
}
}
- public void SuckHp(uint suckHP, SkillConfig skillConfig)
- {
- teamHero.curHp = Math.Min(teamHero.maxHp, teamHero.curHp + (int)suckHP);
- }
- public void HurtByReflect(uint bounceHP, SkillConfig skillConfig)
- {
- teamHero.curHp = Math.Max(0, teamHero.curHp - (int)bounceHP);
- }
-
+ const float pingpongTime = 0.4f;
// 闂伩寮�濮�
public virtual void OnDodgeBegin()
{
- float pingpongTime = 0.2f;
RectTransform rectTrans = heroRectTrans;
var tween = rectTrans.DOAnchorPos(new Vector3(-30, 0, 0), pingpongTime)
.SetEase(Ease.OutCubic);
+
+ motionBase.ShowIllusionShadow(true);
+
+ tween.onComplete += () =>
+ {
+ motionBase.ShowIllusionShadow(false);
+ };
battleField.battleTweenMgr.OnPlayTween(tween);
}
@@ -302,7 +376,6 @@
// 闂伩缁撴潫
public virtual void OnDodgeEnd(Action _complete = null)
{
- float pingpongTime = 0.2f;
RectTransform rectTrans = heroRectTrans;
var tween = rectTrans.DOAnchorPos(Vector3.zero, pingpongTime)
@@ -343,33 +416,26 @@
}
// 浼ゅ杩樿鐪� 鏄惁闂伩 鏆村嚮 and so on 闇�瑕佹湁涓�涓狣amageType 鏈嶅姟鍣ㄥ簲璇ヤ細缁�
- protected virtual BattleDmgInfo PopDamage(List<long> damageValues, long _totalDamage, HB427_tagSCUseSkill.tagSCUseSkillHurt hurt, SkillConfig skillConfig)
+ protected virtual BattleDmgInfo PopDamage(BattleHurtParam battleHurtParam)
{
- BattleDmgInfo battleDmgInfo = new BattleDmgInfo(battleField.guid, damageValues, this, hurt, skillConfig);
-
- if (battleDmgInfo.IsType(DamageType.Dodge))
+ BattleDmgInfo battleDmgInfo = new BattleDmgInfo(battleField.guid, battleHurtParam);
+ // 澶╁瓙鐨勬寫鎴樻嫤鎴鏉¢�昏緫
+ BattleObject boss = battleField.FindBoss();
+ if (boss != null && battleField.MapID == 30020 && boss.ObjID == battleHurtParam.hurtObj.ObjID)
{
- OnDodgeBegin();
- DodgeFinishAction dodgeFinish = new DodgeFinishAction(battleField, this);
- battleField.recordPlayer.InsertRecord(dodgeFinish);
+ EventBroadcast.Instance.Broadcast(EventName.BATTLE_DAMAGE_TAKEN, battleDmgInfo);
+ return battleDmgInfo;
+ }
+ else
+ {
+ // 浣跨敤浼犲叆鐨� fromHp 鍜� toHp 鏇存柊琛�鏉℃樉绀�
+ heroInfoBar.UpdateHP(battleHurtParam.fromHp, battleHurtParam.toHp, teamHero.maxHp);
+
+ // YYL TODO 鏄惁闇�瑕佹寕鍦ㄥ湪鑷韩鐨刦ollow鐐逛笂
+ EventBroadcast.Instance.Broadcast(EventName.BATTLE_DAMAGE_TAKEN, battleDmgInfo);
+ return battleDmgInfo;
}
- int currentHurtHp = 0;
- for (int i = 0; i < damageValues.Count; i++)
- {
- currentHurtHp += (int)damageValues[i];
- }
-
- bool isRecovery = battleDmgInfo.IsType(DamageType.Recovery);
-
- long toHp = Math.Max(0, teamHero.curHp + (isRecovery ? currentHurtHp : -currentHurtHp));
-
- heroInfoBar.UpdateHP(teamHero.curHp, toHp, teamHero.maxHp);
- teamHero.curHp = toHp;
-
- // YYL TODO 鏄惁闇�瑕佹寕鍦ㄥ湪鑷韩鐨刦ollow鐐逛笂
- EventBroadcast.Instance.Broadcast(EventName.BATTLE_DAMAGE_TAKEN, battleDmgInfo);
- return battleDmgInfo;
}
public RectTransform GetAliasTeamNode()
@@ -402,21 +468,21 @@
public void PushDropItems(BattleDrops _battleDrops)
{
- battleDrops = _battleDrops;
+ m_battleDrops = _battleDrops;
}
public void PerformDrop()
{
- if (null == battleDrops || battleDrops.dropItemPackIndex.Count == 0)
+ if (null == m_battleDrops || m_battleDrops.dropItemPackIndex.Count == 0)
return;
EventBroadcast.Instance.Broadcast<string, BattleDrops, Action>(
- EventName.BATTLE_DROP_ITEMS, battleField.guid, battleDrops, OnPerformDropFinish);
+ EventName.BATTLE_DROP_ITEMS, battleField.guid, m_battleDrops, OnPerformDropFinish);
}
protected void OnPerformDropFinish()
{
- battleDrops = null;
+ m_battleDrops = null;
}
public void SetBack()
@@ -432,6 +498,7 @@
public void SetSpeedRatio(float ratio)
{
motionBase.SetSpeedRatio(ratio);
+ heroInfoBar.SetSpeedRatio(ratio);
}
--
Gitblit v1.8.0