From b215788256ab3d86414ed164383245ec85ce35a1 Mon Sep 17 00:00:00 2001 From: xianyi Date: Wed, 20 Aug 2025 16:16:27 +0800 Subject: [PATCH] =?UTF-8?q?=E6=81=A2=E5=A4=8D=E5=8D=A1=E6=A7=BD=E5=8F=AF?= =?UTF-8?q?=E9=80=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../TcgEngine/Scripts/GameClient/BoardSlot.cs | 8 +++---- .../Scripts/GameClient/BoardSlotGroup.cs | 4 ++-- .../Scripts/GameClient/BoardSlotPlayer.cs | 21 +++++++++---------- .../TcgEngine/Scripts/GameClient/HandCard.cs | 1 + Assets/TcgEngine/Scripts/GameLogic/Game.cs | 4 ---- 5 files changed, 17 insertions(+), 21 deletions(-) diff --git a/Assets/TcgEngine/Scripts/GameClient/BoardSlot.cs b/Assets/TcgEngine/Scripts/GameClient/BoardSlot.cs index 9ea583f..dc6e573 100644 --- a/Assets/TcgEngine/Scripts/GameClient/BoardSlot.cs +++ b/Assets/TcgEngine/Scripts/GameClient/BoardSlot.cs @@ -57,14 +57,14 @@ namespace TcgEngine.Client //Find target opacity value target_alpha = 0f; - if (your_turn && dcard != null && dcard.CardData.IsBoardCard() && gdata.CanPlayCard(dcard, slot, true)) + if (your_turn && dcard != null && dcard.CardData.IsBoardCard() && gdata.CanPlayCard(dcard, slot)) { - target_alpha = 1f; //hightlight when dragging a character or artifact (skip mana cost) + target_alpha = 1f; //hightlight when dragging a character or artifact } - if (your_turn && dcard != null && dcard.CardData.IsRequireTarget() && gdata.CanPlayCard(dcard, slot, true)) + if (your_turn && dcard != null && dcard.CardData.IsRequireTarget() && gdata.CanPlayCard(dcard, slot)) { - target_alpha = 1f; //Highlight when dragin a spell with target (skip mana cost) + target_alpha = 1f; //Highlight when dragin a spell with target } if (gdata.selector == SelectorType.SelectTarget && player.player_id == gdata.selector_player_id) diff --git a/Assets/TcgEngine/Scripts/GameClient/BoardSlotGroup.cs b/Assets/TcgEngine/Scripts/GameClient/BoardSlotGroup.cs index ad3502c..8e33899 100644 --- a/Assets/TcgEngine/Scripts/GameClient/BoardSlotGroup.cs +++ b/Assets/TcgEngine/Scripts/GameClient/BoardSlotGroup.cs @@ -77,8 +77,8 @@ namespace TcgEngine.Client { foreach (GroupSlot slot in group_slots) { - if(gdata.CanPlayCard(dcard, slot.slot, true)) - target_alpha = 1f; //hightlight when dragging a character or artifact (skip mana cost) + if(gdata.CanPlayCard(dcard, slot.slot)) + target_alpha = 1f; //hightlight when dragging a character or artifact } } diff --git a/Assets/TcgEngine/Scripts/GameClient/BoardSlotPlayer.cs b/Assets/TcgEngine/Scripts/GameClient/BoardSlotPlayer.cs index b1ac1dc..c859391 100644 --- a/Assets/TcgEngine/Scripts/GameClient/BoardSlotPlayer.cs +++ b/Assets/TcgEngine/Scripts/GameClient/BoardSlotPlayer.cs @@ -67,17 +67,16 @@ namespace TcgEngine.Client target_alpha = 0f; Card select_card = bcard_selected?.GetCard(); - // if (select_card != null) - // { - // bool can_do_attack = gdata.IsPlayerActionTurn(player) && select_card.CanAttack(); - // bool can_be_attacked = gdata.CanAttackTarget(select_card, oplayer); - - // 敌方可被攻击时高亮 - // if (can_do_attack && can_be_attacked) - // { - // target_alpha = 1f; - // } - //} + if (select_card != null) + { + bool can_do_attack = gdata.IsPlayerActionTurn(player) && select_card.CanAttack(); + bool can_be_attacked = gdata.CanAttackTarget(select_card, oplayer); + + if (can_do_attack && can_be_attacked) + { + target_alpha = 1f; + } + } if (your_turn && drag_card != null && drag_card.CardData.IsRequireTargetSpell() && gdata.IsPlayTargetValid(drag_card.GetCard(), GetPlayer())) { diff --git a/Assets/TcgEngine/Scripts/GameClient/HandCard.cs b/Assets/TcgEngine/Scripts/GameClient/HandCard.cs index 985f2f3..ed08b25 100644 --- a/Assets/TcgEngine/Scripts/GameClient/HandCard.cs +++ b/Assets/TcgEngine/Scripts/GameClient/HandCard.cs @@ -234,6 +234,7 @@ namespace TcgEngine.Client // 检查本回合是否已经上场过场上卡牌(只有怪物牌等场上卡牌受限制) if (card.CardData.IsBoardCard() && player.cards_played_this_turn >= 1) { + // TODO 通知 Debug.Log("本回合只能上场一张场上卡牌"); return; } diff --git a/Assets/TcgEngine/Scripts/GameLogic/Game.cs b/Assets/TcgEngine/Scripts/GameLogic/Game.cs index 583c7ab..7305e48 100644 --- a/Assets/TcgEngine/Scripts/GameLogic/Game.cs +++ b/Assets/TcgEngine/Scripts/GameLogic/Game.cs @@ -187,10 +187,6 @@ namespace TcgEngine if (target.HasStatus(StatusType.Protected) && !attacker.HasStatus(StatusType.Flying)) return false; //Protected by taunt - // 检查目标玩家场上是否有卡牌,如有则无法直接攻击玩家 - if (target.cards_board.Count > 0) - return false; //Cannot attack player when they have cards on board - return true; }