Exemplo n.º 1
0
        public void Attack()
        {
            switch (_currentAttackMode)
            {
            case AttackMode.Exploratory:
                var possibleHit = _exploratoryAttack.Attack();
                _currentAttackMode = possibleHit.AttackMode;

                if (possibleHit.Hit)
                {
                    _lastHit = possibleHit;
                    _afterHitAttack.Attack(possibleHit);
                }
                break;

            case AttackMode.AfterHit:
                _lastHit           = _afterHitAttack.Attack(_lastHit);
                _currentAttackMode = _lastHit.AttackMode;

                if (_lastHit.Hit)
                {
                    Attack();
                }
                break;
            }

            _boardDrawer.DrawBoard(false);
        }
Exemplo n.º 2
0
        private bool CheckInput(string strInput)
        {
            if (strInput == "board")
            {
                _boardDrawer.DrawBoard(true);
                return(false);
            }

            if (strInput.Length > 2 || strInput.Length < 2)
            {
                Console.WriteLine("Wrong input");
                return(false);
            }

            if (!Char.IsNumber(strInput[1]))
            {
                Console.WriteLine("Wrong input");
                return(false);
            }

            if (strInput[0] == 'A' ||
                strInput[0] == 'B' ||
                strInput[0] == 'C' ||
                strInput[0] == 'D' ||
                strInput[0] == 'E' ||
                strInput[0] == 'F' ||
                strInput[0] == 'G' ||
                strInput[0] == 'H' ||
                strInput[0] == 'I' ||
                strInput[0] == 'J' ||
                strInput[0] == 'a' ||
                strInput[0] == 'b' ||
                strInput[0] == 'c' ||
                strInput[0] == 'd' ||
                strInput[0] == 'e' ||
                strInput[0] == 'f' ||
                strInput[0] == 'g' ||
                strInput[0] == 'h' ||
                strInput[0] == 'i' ||
                strInput[0] == 'j')
            {
                return(true);
            }

            return(false);
        }