public bool FindInvincibleHunters(List <GamePiece> listOfPieces) { int invincibleHunterCount = 0; foreach (GamePiece pieceInList in listOfPieces) { if (pieceInList.Name.Contains("Hunter")) { Hunter hunterPiece = (Hunter)pieceInList; if (hunterPiece.StoppedCount == 0) { invincibleHunterCount += 1; Console.WriteLine("There's an invincible Hunter in this List"); } else { Console.WriteLine($"Hunter {hunterPiece.Name}'s stopper count is {hunterPiece.StoppedCount}"); hunterPiece.StoppedCount -= 1; } } Console.WriteLine(pieceInList.Name); } if (invincibleHunterCount > 0) { return(true); } else { return(false); } }
public void SetStopperSwitches(List <GamePiece> listOfPieces) { foreach (GamePiece pieceInList in listOfPieces) { if (pieceInList.Name.Contains("Hunter")) { Hunter hunterPiece = (Hunter)pieceInList; hunterPiece.StoppedCount = 3; Console.WriteLine($"Hunter {hunterPiece.Name} stopper is {hunterPiece.StoppedCount}"); } } }
public void ScoreDrofsnar(List <GamePiece> cell, Player currentDrofsnar) { Console.WriteLine($"Begin scoring. Drofsnar's score is {currentDrofsnar.PointsCounter}"); Console.ReadLine(); int i = 0; while (i < cell.Count) { bool removed = false; if (cell[i].Name.Contains("Hunter")) { Hunter hunterPiece = (Hunter)cell[i]; if (hunterPiece.StoppedCount > 0) { currentDrofsnar.PointsCounter += 2 ^ (currentDrofsnar.HunterCount) * hunterPiece.Points; currentDrofsnar.HunterCount += 1; hunterPiece.IsEliminated = true; cell.Remove(hunterPiece); i = 0; removed = true; Console.WriteLine($"Drofsnar has now chomped {currentDrofsnar.HunterCount} Hunters. Drofsnar's score is {currentDrofsnar.PointsCounter}"); Console.ReadLine(); } } else { if (!cell[i].Name.Contains("Stopper") && !cell[i].Name.Contains("Drofsnar")) { currentDrofsnar.PointsCounter += cell[i].Points; cell[i].IsEliminated = true; cell.Remove(cell[i]); i = 0; removed = true; Console.WriteLine($"Drofsnar caught a {cell[i].Name}. Drofsnar's score is {currentDrofsnar.PointsCounter}"); Console.ReadLine(); } else { i++; } } } }