2
0

2 Коммиты d1394b9bc9 ... a5b5cb6fe0

Автор SHA1 Сообщение Дата
  zhengchen a5b5cb6fe0 Merge remote-tracking branch 'origin/master' 1 год назад
  zhengchen c268f9d85b 补充50%血量以下允许举J 1 год назад

+ 3 - 3
Assets/Scripts/Comp/BattleMainComp.cs

@@ -28,9 +28,9 @@ namespace Comp
             SoundCore.Instance.PlaySound(SoundType.BattleBgmMain, SoundCtrl.BattleBgmPlayer, true, true);
             MessageComp.Instance.OnBattleClientMsg += OnClientMsg;
             MessageComp.Instance.OnBattlePlayerQuit += OnPlayerQuit;
-// #if UNITY_EDITOR
-//             _debug = true;
-// #endif
+#if UNITY_EDITOR
+            _debug = true;
+#endif
             if (_debug)
             {
                 var logs =

+ 4 - 1
Assets/Scripts/Comp/LiftButtonComp.cs

@@ -16,8 +16,11 @@ namespace Comp
 
         private void Update()
         {
+            if (GameCore.Instance.localPlayer == null) return;
+            var lastHpPercent = (float)GameCore.Instance.localPlayer.runTimeHp / GameCore.Instance.localPlayer.hp;
             if (GameCore.Instance.GetCurState() != null && GameCore.Instance.battleState != null &&
-                GameCore.Instance.GetCurState() == GameCore.Instance.battleState && GameCore.Instance.liftTimes > 0)
+                GameCore.Instance.GetCurState() == GameCore.Instance.battleState && GameCore.Instance.liftTimes > 0 &&
+                lastHpPercent <= 0.5f)
             {
                 _button.interactable = true;
             }

+ 4 - 0
Assets/Scripts/Game/GameBattleState.cs

@@ -104,6 +104,10 @@ namespace Game
                 var attackCockActionComp = _gameCore.GetCockActionCompByPlayerId(log.from);
                 attackCockActionComp.SetHighJump(i == 0);
                 var counterattackCockActionComp = _gameCore.GetCockActionCompByPlayerId(log.to);
+                var counterattackPlayer = _gameCore.localPlayer.playerId == log.to
+                    ? _gameCore.localPlayer
+                    : _gameCore.antiPlayer;
+                counterattackPlayer.runTimeHp -= log.value;
                 if (i == 0 && log.value == 0) // 攻击落空了
                 {
                     counterattackCockActionComp.CreateMiss();