Esempio n. 1
0
        public CardPlayedResult PlayCard(Card card, Player source, Target target)
        {
            CardPlayedResult res = IsCardPlayable(card, source, target);

            if (res == CardPlayedResult.CARD_PLAYED)
            {
                EventManager.Instance.onCardPlayed(card, source, target);
            }

            return(res);
        }
Esempio n. 2
0
        private CardPlayedResult IsCardPlayable(Card card, Player source, Target target)
        {
            CardPlayedResult result = CardPlayedResult.CARD_PLAYED;
            int dist = CalculateDistanceBetweenPlayers(source, target.GetPlayer());

            if (!IsCorrectTarget(card, target))
            {
                result = CardPlayedResult.INVALID_TARGET;
            }
            else if (IsSourceOrCardInRange(source, card, dist))
            {
                result = CardPlayedResult.TARGET_TOO_FAR;
            }

            return(result);
        }