public static List <Card> GetPotentialBoardTargets(BattleCryTargetAction action) { List <Card> boardCards = new List <Card>(); bool allyTarget = action.AllyOnly || action.TwoWay; if (allyTarget) { foreach (var c in GameState.Get().GetFriendlySidePlayer().GetBattlefieldZone().GetCards()) { boardCards.Add(c); } } bool enemyTarget = action.EnemyOnly || action.TwoWay; if (enemyTarget) { foreach (var c in GameState.Get().GetOpposingSidePlayer().GetBattlefieldZone().GetCards()) { boardCards.Add(c); } } if (action.CanTargetHero) { if (allyTarget) { boardCards.Add(GetHeroCard(true)); } if (enemyTarget) { boardCards.Add(GetHeroCard(false)); } } if (action.CopyDeathrattle) { List <Card> _boardCards = new List <Card>(); foreach (var card in boardCards) { if (card.GetEntity().HasDeathrattle()) { _boardCards.Add(card); } } boardCards = _boardCards; } if (action.XAttackOrLess) { List <Card> _boardCards = new List <Card>(); foreach (var card in boardCards) { if (card.GetEntity().GetRealTimeAttack() <= action.MaxAttack) { _boardCards.Add(card); } } boardCards = _boardCards; } if (action.XAttackOrMore) { List <Card> _boardCards = new List <Card>(); foreach (var card in boardCards) { if (card.GetEntity().GetRealTimeAttack() >= action.MaxAttack) { _boardCards.Add(card); } } boardCards = _boardCards; } if (action.DestroyTaunt) { List <Card> _boardCards = new List <Card>(); foreach (var card in boardCards) { if (card.GetEntity().HasTaunt()) { _boardCards.Add(card); } } boardCards = _boardCards; } if (action.RaceOnly != TAG_RACE.INVALID) { List <Card> _boardCards = new List <Card>(); foreach (var card in boardCards) { if (card.GetEntity().GetRace() == action.RaceOnly) { _boardCards.Add(card); } } boardCards = _boardCards; } if (action.OnlyIfSectretExists && GameState.Get().GetFriendlySidePlayer().GetSecretZone().GetCards().Count == 0) { return(null); } int numDragonsHand = 0; foreach (var card in GameState.Get().GetFriendlySidePlayer().GetHandZone().GetCards()) { if (card.GetEntity().GetRace() == TAG_RACE.DRAGON) { numDragonsHand++; } } if (action.OnlyIfHoldingDragon && numDragonsHand == 0) { return(null); } //Cant trigger enemy stealth List <Card> __boardCards = new List <Card>(); foreach (var card in boardCards) { bool cantTarget = card.GetEntity().IsStealthed() && !card.GetEntity().GetController().IsFriendlySide(); if (!cantTarget) { __boardCards.Add(card); } } boardCards = __boardCards; return(boardCards); }
public static bool CorrespondsToBattleCryAction(Card c, BattleCryTargetAction action) { return(action.CardID == c.GetEntity().GetCardId()); }