Files
tcg-client/Assets/TcgEngine/Scripts/Conditions/ConditionCardPile.cs
2025-09-28 16:22:32 +08:00

71 lines
2.0 KiB
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace TcgEngine
{
/// <summary>
/// 检查卡片在哪个堆栈中的条件(牌组/弃牌/手牌/棋盘/秘密)
/// </summary>
[CreateAssetMenu(fileName = "condition", menuName = "TcgEngine/Condition/CardPile", order = 10)]
public class ConditionCardPile : ConditionData
{
[Header("Card is in pile")]
public PileType type;
public ConditionOperatorBool oper;
public override bool IsTargetConditionMet(Game data, AbilityData ability, Card caster, Card target)
{
if (target == null)
return false;
if (type == PileType.Hand)
{
return CompareBool(data.IsInHand(target), oper);
}
if (type == PileType.Board)
{
return CompareBool(data.IsOnBoard(target), oper);
}
if (type == PileType.Equipped)
{
return CompareBool(data.IsEquipped(target), oper);
}
if (type == PileType.Deck)
{
return CompareBool(data.IsInDeck(target), oper);
}
if (type == PileType.Discard)
{
return CompareBool(data.IsInDiscard(target), oper);
}
if (type == PileType.Secret)
{
return CompareBool(data.IsInSecret(target), oper);
}
if (type == PileType.Temp)
{
return CompareBool(data.IsInTemp(target), oper);
}
return false;
}
public override bool IsTargetConditionMet(Game data, AbilityData ability, Card caster, Player target)
{
return false; //Player cannot be in a pile
}
public override bool IsTargetConditionMet(Game data, AbilityData ability, Card caster, Slot target)
{
return type == PileType.Board && target != Slot.None; //Slot is always on board
}
}
}