UsePoisonPill() public method

public UsePoisonPill ( ) : void
return void
コード例 #1
0
        public static Enums.TurnOutcome ProcessMove(Maze currentMaze, Maze previousMaze, Point currentPosition, Point previousPosition, Point opponentPosition, Player currentPlayer)
        {
            currentPlayer.SetCurrentPosition(currentPosition);

            if (IsMoveMadeAndScoredPoint(previousMaze, currentPosition))
            {
                currentPlayer.AddToScore(Properties.Settings.Default.SettingPointsPerPill);
                return Enums.TurnOutcome.MoveMadeAndPointScored;
            }

            if (IsMoveMadeAndScoredBonusPoint(previousMaze, currentPosition))
            {
                currentPlayer.AddToScore(Properties.Settings.Default.SettingPointsPerBonusPill);
                return Enums.TurnOutcome.MoveMadeAndBonusPointScored;
            }

            if (IsMoveMadeAndDiedFromPoisonPill(previousMaze, currentPosition))
            {
                currentMaze.SetSymbol(currentPosition.X, currentPosition.Y, Symbols.SYMBOL_EMPTY);
                currentMaze.SetSymbol(Properties.Settings.Default.MazeCenterX, Properties.Settings.Default.MazeCenterY, Symbols.SYMBOL_PLAYER_A);
                return Enums.TurnOutcome.MoveMadeAndDiedFromPoisonPill;
            }

            if (IsMoveMadeAndKilledOpponent(currentPosition, opponentPosition))
            {
                currentMaze.SetSymbol(Properties.Settings.Default.MazeCenterX, Properties.Settings.Default.MazeCenterY, Symbols.SYMBOL_PLAYER_B);
                return Enums.TurnOutcome.MoveMadeAndKilledOpponent;
            }

            if (IsMoveMadeAndDroppedPoisonPill(currentMaze, previousPosition))
            {
                if (!currentPlayer.IsAllowedPoisonPillDrop())
                    return Enums.TurnOutcome.MoveMadeAndDroppedPoisonPillIllegally;

                currentPlayer.UsePoisonPill();
                return Enums.TurnOutcome.MoveMadeAndDroppedPoisonPill;
            }

            return (int)Enums.TurnOutcome.MoveMade;
        }