/// <summary> /// Places Nigiri Card on top of a Wasabi Card. /// </summary> protected void PlaceOnWasabi() { //Checks if there is a Wasabi card already on the board if (Hand.CardsInHandList[SelectedCardIndex] is Nigiri && Board.CheckForWasabi() == true) { Nigiri n = (Nigiri)Hand.CardsInHandList[SelectedCardIndex]; n.OnWasabi = true; //Place the Nigiri Card on top of the Wasabi and remove wasabi card from list Board.CardsPlayedList.RemoveAt(Board.GetWasabiIndex()); Board.PlayArea.Items.Insert(Board.GetWasabiIndex() + 1, n.ToString()); Board.Refresh(); } }
//#################################################################### //# Public Methods /// <summary> /// Calculates the number of points a player /// earns in a round. /// </summary> /// <returns>The number of points</returns> public int CalcPoints() { //Variables to count the number of instances of a card int tempuraCount = 0; int sashimiCount = 0; int dumplingCount = 0; foreach (Card c in Board.CardsPlayedList) { //If the card is a tempura if (c is Tempura) { tempuraCount++; } //If the card is a sashimi if (c is Sashimi) { sashimiCount++; } //If the card is a dumpling if (c is Dumpling) { dumplingCount++; } //If the Card is a Nigiri card if (c is Nigiri) { Nigiri n = (Nigiri)c; if (n.OnWasabi == false) { //If it is an Egg Nigiri Card if (n.Type == Nigiri.NigiriType.Egg) { Points++; } //If it is a Salmon Nigiri Card if (n.Type == Nigiri.NigiriType.Salmon) { Points += 2; } //If it is a Squid Nigiri Card if (n.Type == Nigiri.NigiriType.Squid) { Points += 3; } } else if (n.OnWasabi == true) { //If it is an Egg Nigiri Card that is on a Wasabi if (n.Type == Nigiri.NigiriType.Egg) { Points += 3; } //If it is a Salmon Nigiri Card that is on a Wasabi if (n.Type == Nigiri.NigiriType.Salmon) { Points += 6; } //If it is a Squid Nigiri Card that is on a Wasabi if (n.Type == Nigiri.NigiriType.Squid) { Points += 9; } } } } //Calculate the number of points for each set of 2 tempura cards if (tempuraCount % 2 == 0) { Points += (tempuraCount / 2) * 5; } //Calculate the number of points for each set of 3 sashimi cards if (sashimiCount % 3 == 0) { Points += (sashimiCount / 3) * 10; } //Calculate the number of points based on the number dumpling cards a player has if (dumplingCount == 1) { Points++; } else if (dumplingCount == 2) { Points += 3; } else if (dumplingCount == 3) { Points += 6; } else if (dumplingCount == 4) { Points += 10; } else if (dumplingCount <= 5) { Points += 15; } return(Points); }