Esempio n. 1
0
        public bool DraculaMovementPhase(GameState g, UserInterface ui)
        {
            Logger.WriteToDebugLog("STARTING MOVEMENT PHASE");

            // build list of possible locations to move to
            DeterminePossibleLocations();

            // build list of possible powers to play
            DeterminePossiblePowers(g.Time());

            // check if there are no legal moves
            Logger.WriteToDebugLog("Checking if there are legal moves");
            if (PossibleMoves.Count() + PossiblePowers.Count() == 0)
            {
                Logger.WriteToDebugLog("Dracula has no legal moves");
                ui.TellUser("Dracula is cornered by his own trail");
                return false;
            }
            else if (PossibleMoves.Count() == 0 && PossiblePowers.Count() == 1 && PossiblePowers.Contains(Powers[1]))
            {
                Logger.WriteToDebugLog("Dracula has no regular moves available");
                DeterminePossibleWolfFormLocations();
                if (PossibleMoves.Count() == 0)
                {
                    Logger.WriteToDebugLog("Dracula has no moves available by Wolf Form");
                    ui.TellUser("Dracula is cornered by his own trail");
                    return false;
                }
                DeterminePossibleLocations();
            }

            string powerUsed;
            LocationDetail destination = logic.DecideMove(g, this, out powerUsed);

            // choose a power
            if (powerUsed != "no power")
            {
                Logger.WriteToDebugLog("Dracula has chosen power " + powerUsed);
                if (powerUsed != "Double Back" && powerUsed != "Wolf Form")
                {
                    Logger.WriteToGameLog("Dracula used power " + powerUsed);
                }

                if (powerUsed == "Dark Call" || powerUsed == "Feed" || powerUsed == "Hide")
                {
                    AddDummyPowerCardToTrail(powerUsed);
                    if (powerUsed == "Hide")
                    {
                        LocationWhereHideWasUsed = CurrentLocation;
                    }
                    if (powerUsed == "Dark Call")
                    {
                        Blood -= 2;
                    }
                    if (powerUsed == "Feed" && Blood < 15)
                    {
                        Blood++;
                    }
                }
                else if (powerUsed == "Double Back")
                {
                    DoDoubleBackMove(g, destination, ui);
                }
                else if (powerUsed == "Wolf Form")
                {
                    DoWolfFormMove(g, destination, ui);
                    Blood--;
                }

                // put the power used at the head of the trail
                Logger.WriteToDebugLog("Putting power " + powerUsed + " at the head of the trail");
                PossiblePowers[PossiblePowers.FindIndex(power => power.name == powerUsed)].positionInTrail = 0;
            }
            else
            // performing a regular move
            {
                // choose a location
                MoveByRoadOrSea(g, destination, ui);
                Logger.WriteToGameLog("Dracula moved to " + CurrentLocation.Name);
            }
            Logger.WriteToDebugLog("Dracula has finished moving");
            return true;
        }