调整卡牌攻击
- 场上存在卡牌时无法直接攻击敌方玩家 - 取消卡牌攻击敌方玩家高亮显示 - 一回合只能上场一张角色卡
This commit is contained in:
@@ -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))
|
||||
if (your_turn && dcard != null && dcard.CardData.IsBoardCard() && gdata.CanPlayCard(dcard, slot, true))
|
||||
{
|
||||
target_alpha = 1f; //hightlight when dragging a character or artifact
|
||||
target_alpha = 1f; //hightlight when dragging a character or artifact (skip mana cost)
|
||||
}
|
||||
|
||||
if (your_turn && dcard != null && dcard.CardData.IsRequireTarget() && gdata.CanPlayCard(dcard, slot))
|
||||
if (your_turn && dcard != null && dcard.CardData.IsRequireTarget() && gdata.CanPlayCard(dcard, slot, true))
|
||||
{
|
||||
target_alpha = 1f; //Highlight when dragin a spell with target
|
||||
target_alpha = 1f; //Highlight when dragin a spell with target (skip mana cost)
|
||||
}
|
||||
|
||||
if (gdata.selector == SelectorType.SelectTarget && player.player_id == gdata.selector_player_id)
|
||||
|
||||
@@ -77,8 +77,8 @@ namespace TcgEngine.Client
|
||||
{
|
||||
foreach (GroupSlot slot in group_slots)
|
||||
{
|
||||
if(gdata.CanPlayCard(dcard, slot.slot))
|
||||
target_alpha = 1f; //hightlight when dragging a character or artifact
|
||||
if(gdata.CanPlayCard(dcard, slot.slot, true))
|
||||
target_alpha = 1f; //hightlight when dragging a character or artifact (skip mana cost)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -67,16 +67,17 @@ 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 (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 (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()))
|
||||
{
|
||||
|
||||
@@ -231,9 +231,10 @@ namespace TcgEngine.Client
|
||||
return;
|
||||
}
|
||||
|
||||
if (!player.CanPayMana(card))
|
||||
// 检查本回合是否已经上场过场上卡牌(只有怪物牌等场上卡牌受限制)
|
||||
if (card.CardData.IsBoardCard() && player.cards_played_this_turn >= 1)
|
||||
{
|
||||
WarningText.ShowNoMana();
|
||||
Debug.Log("本回合只能上场一张场上卡牌");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -186,6 +186,10 @@ 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;
|
||||
}
|
||||
|
||||
|
||||
@@ -303,7 +303,18 @@ namespace TcgEngine.Server
|
||||
{
|
||||
Card card = player.GetCard(msg.card_uid);
|
||||
if (card != null && card.player_id == player.player_id)
|
||||
{
|
||||
// 检查本回合是否已经上场过场上卡牌(只有怪物牌等场上卡牌受限制)
|
||||
if (card.CardData.IsBoardCard() && player.cards_played_this_turn >= 1)
|
||||
return; // 已经上场过场上卡牌,不能再上场
|
||||
|
||||
// 手动上场卡牌:跳过mana消耗
|
||||
// gameplay.PlayCard(card, msg.slot, true);
|
||||
gameplay.PlayCard(card, msg.slot);
|
||||
// 只有场上卡牌才增加计数
|
||||
if (card.CardData.IsBoardCard())
|
||||
player.cards_played_this_turn++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -33,9 +33,15 @@ namespace TcgEngine.UI
|
||||
|
||||
public void Refresh()
|
||||
{
|
||||
if (icons == null)
|
||||
return;
|
||||
|
||||
int index = 0;
|
||||
foreach (Image icon in icons)
|
||||
{
|
||||
if (icon == null)
|
||||
continue;
|
||||
|
||||
icon.gameObject.SetActive(index < value || index < max_value);
|
||||
icon.sprite = (index < value) ? sprite_full : sprite_empty;
|
||||
index++;
|
||||
@@ -44,8 +50,12 @@ namespace TcgEngine.UI
|
||||
|
||||
public void SetMat(Material mat)
|
||||
{
|
||||
if (icons == null)
|
||||
return;
|
||||
|
||||
foreach (Image icon in icons)
|
||||
{
|
||||
if (icon != null)
|
||||
icon.material = mat;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user