Exemple #1
0
        public static void RoundEnd()
        {
            Console.WriteLine("End round? Press Y to confirm. Press N to go back.");
            var userKey = Console.ReadKey();

            if (userKey.Key == ConsoleKey.N)
            {
                return;
            }

            if (userKey.Key == ConsoleKey.Y)
            {
                GameMechanics.AttackReset();
                return;
            }

            //attackReady se mora prebaciti na false napadaću.
            //sustav mora spremiti novo stanje entiteta u board.json i vratiti EntityAttackedMessage(na konzolu) sa sljedećim poljima: sourceId, targetId i value.
            //Napadi se simuliraju u rundama, svaki entitet može(ali ne mora) napasti jednom po rundi.
        }
Exemple #2
0
        public static void EntityAttack()
        {
            GameMechanics gameMechanics = new GameMechanics();

            Console.WriteLine("Enter sourceId for attack source.");
            var sourceId     = Console.ReadLine();
            var sourceEntity = Root.LiveEntities.SingleOrDefault(entity => entity.entityId == sourceId);

            if (EntityValid(sourceEntity) == false)
            {
                return;
            }
            if (EntityDisplayCheck(sourceEntity) == false)
            {
                return;
            }

            Console.WriteLine("Enter targetId for attack target.");
            var targetId     = Console.ReadLine();
            var targetEntity = Root.LiveEntities.SingleOrDefault(entity => entity.entityId == targetId);

            if (EntityValid(targetEntity) == false)
            {
                return;
            }
            if (EntityDisplayCheck(targetEntity) == false)
            {
                return;
            }

            if (gameMechanics.AttackCheck(sourceEntity, targetEntity) == true)
            {
                gameMechanics.AttackProcess(sourceEntity, targetEntity);
                JsonAccess.JsonEntitiesSave(Root.Entities);
            }
        }