Пример #1
0
        public Player(int x, int y, int difficultyRate)
        {
            var inventoryLength = 8;

            HP                  = 100;
            X                   = x;
            Y                   = y;
            Food                = 100;
            IsAlive             = true;
            IsEnoughForChurch   = false;
            Inventory           = new IItem[inventoryLength];
            InventoryItemsCount = new int[inventoryLength];
            for (int i = 0; i < inventoryLength; i++)
            {
                InventoryItemsCount[i] = 0;
                Inventory[i]           = new EmptyItem();
            }
            WoodCount  = 0;
            StoneCount = 0;
            GoldCount  = 0;
            if (difficultyRate * 10 >= 64)
            {
                DifficultyRate = 10;
            }
            else
            {
                DifficultyRate = difficultyRate;
            }
        }
Пример #2
0
        public IItem UseItem(int i, int count)
        {
            var item = Inventory[i];

            if (item is FoodItem)
            {
                Heal(25);
            }
            if (!(item is Axe) || !(item is Pickaxe))
            {
                InventoryItemsCount[i] -= count;
            }
            if (InventoryItemsCount[i] <= 0)
            {
                Inventory[i]           = new EmptyItem();
                InventoryItemsCount[i] = 0;
            }
            return(item);
        }