You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

71 lines
1.7 KiB

using System;
using System.Collections.Generic;
using TheGameExtreme.model.card;
using TheGameExtreme.model.card.cardType;
using TheGameExtreme.model.card.rapidCard;
namespace TheGameExtreme.model.deck
{
public class ExtremeDeck : Deck
{
private List<int> endGame;
private List<int> threeCard;
private Random random = new Random();
public ExtremeDeck(int nbCard) : base(nbCard)
{
endGame = new List<int>();
threeCard = new List<int>();
createEndCard();
createThreeCard();
for (int i = 2; i <= 99; i++)
{
deck.Add(createCard(i));
}
}
private void createEndCard()
{
while (endGame.Count < 4)
{
int r = random.Next(2, 99);
if (!endGame.Contains(r))
{
endGame.Add(r);
}
}
}
private void createThreeCard()
{
while (threeCard.Count < 4)
{
int r = random.Next(2, 99);
if (!endGame.Contains(r) && !threeCard.Contains(r))
{
threeCard.Add(r);
}
}
}
private Card createCard(int iteration)
{
if (endGame.Contains(iteration))
{
return new EndGameCard(iteration);
}
else if (threeCard.Contains(iteration))
{
return new ThreeCard(iteration);
}
else
{
return new ClassicCard(iteration);
}
}
}
}