场上没有卡牌时自动上场

This commit is contained in:
xianyi
2025-08-06 16:33:48 +08:00
parent f6262481dc
commit 6a7da24965
2 changed files with 89 additions and 3 deletions

View File

@@ -26,7 +26,7 @@ namespace TcgEngine
public int mana = 0;
public int mana_max = 0;
public int kill_count = 0;
public int cards_played_this_turn = 0; // 本回合已上场的卡牌数量
public Dictionary<string, Card> cards_all = new Dictionary<string, Card>(); //Dictionnary for quick access to any card by UID
public Card hero = null;
@@ -556,10 +556,18 @@ namespace TcgEngine
public virtual bool IsDead()
{
if (cards_hand.Count == 0 && cards_board.Count == 0 && cards_deck.Count == 0)
return true;
// 原有的死亡判定血量为0
if (hp <= 0)
return true;
// 新增的死亡判定:无手牌、无场上卡牌,且卡组中还有牌
if (cards_hand.Count == 0 && cards_board.Count == 0 && cards_deck.Count > 0)
return true;
// 原有的死亡判定:所有牌都没有了
if (cards_hand.Count == 0 && cards_board.Count == 0 && cards_deck.Count == 0)
return true;
return false;
}