Esempio n. 1
0
        private static int getNewValue(int currentVal, CardAttributes item)
        {
            int newValue = currentVal + item.value;

            if (newValue < 0)
            {
                newValue = 0;
                if (item.attributes == Attributes.DiamondMines || item.attributes == Attributes.Colliery ||
                    item.attributes == Attributes.Menagerie)
                {
                    newValue = 1;
                }
            }
            return(newValue);
        }
Esempio n. 2
0
        public static void ApplyDirectDamage(CardAttributes item, Player target)
        {
            item.value = item.value > 0 ? -item.value : item.value;
            //делаю число отрицательным, необходимо в базе переделать все эти значения на отрицательные
            int remainingDamage = target.PlayerParams[Attributes.Wall] + item.value;

            target.PlayerParams[Attributes.Wall] = getNewValue(target.PlayerParams[Attributes.Wall], item);

            if (remainingDamage < 0)
            {
                CardAttributes newItem = new CardAttributes()
                {
                    attributes = Attributes.Tower, value = remainingDamage
                };

                target.PlayerParams[Attributes.Tower] = getNewValue(target.PlayerParams[Attributes.Tower], newItem);
            }
        }