Exemplo n.º 1
0
 public void ReturnToken(EnumColour colour)
 {
     if (Tokens.ContainsKey(colour) && Tokens[colour] > 0)
     {
         Tokens[colour]--;
         if (!GameBoard.Instance.AvailableTokens.ContainsKey(colour))
         {
             GameBoard.Instance.AvailableTokens.Add(colour, 0);
         }
         GameBoard.Instance.AvailableTokens[colour]++;
     }
 }
Exemplo n.º 2
0
 public void GetToken(EnumColour colour)
 {
     if (GameBoard.Instance.AvailableTokens.ContainsKey(colour) &&
         GameBoard.Instance.AvailableTokens[colour] > 0)
     {
         GameBoard.Instance.AvailableTokens[colour]--;
         if (!Tokens.ContainsKey(colour))
         {
             Tokens.Add(colour, 0);
         }
         Tokens[colour]++;
     }
 }
Exemplo n.º 3
0
    public int GetBonusAmount(EnumColour colour)
    {
        int sum = 0;

        foreach (DevelopmentCard dc in DevelopmentCards)
        {
            if (dc.Bonus.ContainsKey(colour))
            {
                sum += dc.Bonus[colour];
            }
        }
        return(sum);
    }
Exemplo n.º 4
0
 public static string GetPositionContent(int row, int col, out EnumColour outColour, out EnumShape outShape)
 {
     if (tileGrid[row, col] is null)
     {
         outColour = EnumColour.None;
         outShape  = EnumShape.None;
         return("x");
     }
     else
     {
         outColour = tileGrid[row, col].Colour;
         outShape  = tileGrid[row, col].Shape;
         return(tileGrid[row, col].ToString());
     }
 }
Exemplo n.º 5
0
 public HandCardPerson(EnumColour Colour, int Attack) // Zombiak
 {
     Proffesion = EnumProffesion.Zombie; this.Type = EnumType.Rubbish; this.Attack = Attack; this.Colour = Colour;
 }
Exemplo n.º 6
0
        public void MaxPlaceableTiles(out int highestCount, bool verbose = false)
        {
            highestCount = 0;
            int        maxFoundColourCount = 0;
            int        maxFoundShapeCount  = 0;
            EnumColour maxFoundColour      = EnumColour.Blue;
            EnumShape  maxFoundShape       = EnumShape.Square;

            //dedup the hand first
            List <Tile> dedupHand = new List <Tile>();

            foreach (Tile candidateTile in tilesInHand)
            {
                if (dedupHand.Count == 0)
                {
                    dedupHand.Add(candidateTile);
                    if (verbose)
                    {
                        Console.WriteLine($"---------First Tile---------\n Adding {candidateTile} as it's unique.");
                    }
                }
                else
                {
                    bool duplicate = false;
                    foreach (Tile dedupTile in dedupHand)
                    {
                        if (Tile.IsDuplicate(candidateTile, dedupTile))
                        {
                            duplicate = true;
                        }
                    }
                    if (duplicate)
                    {
                        Console.WriteLine($"{this.Name}: Not considering {candidateTile} as it's a duplicate.");
                    }
                    else
                    {
                        dedupHand.Add(candidateTile); //if it's not a duplicate, add it to the deduplicated list
                        if (verbose)
                        {
                            Console.WriteLine($"Adding {candidateTile} as it's unique.");
                        }
                    }
                }
                if (verbose)
                {
                    Console.WriteLine("--");
                }
            }
            Console.WriteLine($"The dedup list contains {dedupHand.Count} tiles for {this.Name}");

            //now that the hand is deduplicated, let's check for colour matches
            foreach (EnumColour tempColour in Enum.GetValues(typeof(EnumColour)))        //check for colour matches first
            {
                List <Tile> foundTiles = dedupHand.FindAll(i => i.Colour == tempColour); //find all the tiles in the hand which are of the given colour
                if (foundTiles.Count() > maxFoundColourCount)
                {
                    maxFoundColourCount = foundTiles.Count();
                    maxFoundColour      = tempColour;
                }
            }

            //now shape matches
            foreach (EnumShape tempShape in Enum.GetValues(typeof(EnumShape)))         //check for Shape matches
            {
                List <Tile> foundTiles = dedupHand.FindAll(i => i.Shape == tempShape); //find all the tiles in the hand which are of the given Shape
                if (foundTiles.Count() > maxFoundShapeCount)
                {
                    maxFoundShapeCount = foundTiles.Count();
                    maxFoundShape      = tempShape;
                }
            }

            highestCount = Math.Max(maxFoundColourCount, maxFoundShapeCount);
            dedupHand.Clear();
        }
Exemplo n.º 7
0
 public HandCardPerson(EnumProffesion Proffesion, EnumColour Colour, int Attack, EnumSpecialCardSkill SpecjalSkill)  // Żołnierz
 {
     this.Proffesion = Proffesion; this.Type = EnumType.Rubbish; this.Colour = Colour; this.Attack = Attack; this.SpecialSkill = SpecjalSkill;
 }
Exemplo n.º 8
0
 public HandCardPerson(EnumProffesion Proffesion, EnumColour Colour) // Zwykli ludzie
 {
     this.Proffesion = Proffesion; this.Type = EnumType.Rubbish; this.Attack = 1; this.Colour = Colour;
 }
Exemplo n.º 9
0
 public HandCardPerson(EnumType Type, EnumProffesion Proffesion, EnumColour Colour) //Wymienni
 {
     this.Proffesion = Proffesion; this.Type = Type; this.Attack = 1; this.Colour = Colour;
 }
Exemplo n.º 10
0
 public HandCardPerson(EnumProffesion Proffesion, EnumColour Colour, int Attack) // Sportowcy itp
 {
     this.Proffesion = Proffesion; this.Type = EnumType.Rubbish; this.Attack = Attack; this.Colour = Colour;
 }
Exemplo n.º 11
0
 public HandCardPerson(EnumType Type, EnumProffesion Proffesion, EnumColour Colour, int Attack) // Ogólny
 {
     this.Proffesion = Proffesion; this.Type = Type; this.Attack = Attack; this.Colour = Colour;
 }