Пример #1
0
        public virtual int CalculateDamage(Move attack, Neuromon target)
        {
            var damage = attack.Damage * 1.0;
            var multipler = 1.0;

            if (attack.Type.IsEffectiveAgainst(target.Type))
            {
                multipler = _effectiveMultipler;
            }
            else if (attack.Type.IsWeakAgainst(target.Type))
            {
                multipler = _weakMultiplier;
            }

            return (int) Math.Floor(damage * multipler);
        }
Пример #2
0
        public Common.MoveResult Move(Common.Move move)
        {
            var response = new Common.MoveResult();

            response.PlayerMoveResult = gameLogic.Move(move);
            if (response.PlayerMoveResult == Common.MoveResponse.Sucess)
            {
                response.OpponentMove = ((AI)player2).MakeMove(gameLogic);
            }

            if (gameLogic.IsGameOver())
            {
                response.PlayerMoveResult = Common.MoveResponse.GameOver;
                return(response);
            }

            return(response);
        }
Пример #3
0
        public Common.MoveResult Move(Common.Move move)
        {
            var response = new Common.MoveResult();

            response.OpponentMove     = new Move();
            response.PlayerMoveResult = gameLogic.Move(move);
            if (response.PlayerMoveResult == Common.MoveResponse.Sucess)
            {
                gameLogic.gameBoard.UpdateBoard(move, gameLogic.IsPlayer1sTurn());
                gameLogic.SwitchTurns();

                if (isAIInitialized)
                {
                    ((AI)player2).UpdateBoard(move.x, move.y, 1);
                    int[] xy = AIMove();//((AI)player2).Move(2, 1);
                    response.OpponentMove.x = xy[0];
                    response.OpponentMove.y = xy[1];
                    gameLogic.gameBoard.UpdateBoard(response.OpponentMove, false);
                }
                else
                {
                    ((AI)player2).UpdateBoard(move.x, move.y, 1);
                    int[] xy = ((AI)(player2)).Initialize(2, (int)DateTime.Now.Ticks);//send time as seed
                    response.OpponentMove.x = xy[0];
                    response.OpponentMove.y = xy[1];
                    gameLogic.gameBoard.UpdateBoard(response.OpponentMove, false);
                    isAIInitialized = true;
                }

                gameLogic.SwitchTurns();
            }

            if (gameLogic.GameWon())
            {
                response.PlayerMoveResult = Common.MoveResponse.GameOver;
                return(response);
            }

            return(response);
        }