|
|
|
@ -3,6 +3,8 @@ using System.Collections.Generic;
|
|
|
|
|
using TheGameExtreme.model.card;
|
|
|
|
|
using TheGameExtreme.model.deck;
|
|
|
|
|
using TheGameExtreme.model.@event;
|
|
|
|
|
using TheGameExtreme.model.gameActions;
|
|
|
|
|
using TheGameExtreme.model.gameActions.classic;
|
|
|
|
|
using TheGameExtreme.model.rule.beforeEndTurnRules;
|
|
|
|
|
using TheGameExtreme.model.rule.endTurnRules;
|
|
|
|
|
using TheGameExtreme.model.rule.playRules;
|
|
|
|
@ -12,6 +14,35 @@ namespace TheGameExtreme.model.manager
|
|
|
|
|
public abstract class GameManager
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
/* GameMaster implémente un mode de jeu (classe fille de gameMode qui connait les actions a effectué en fonction du mode de jeu */
|
|
|
|
|
|
|
|
|
|
protected GameMode gameMode;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
protected GameManager(GameMode gameMode)
|
|
|
|
|
{
|
|
|
|
|
this.gameMode = gameMode;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public readonly int nbPlayer;
|
|
|
|
|
protected int nbMaxCard;
|
|
|
|
|
protected int currentIndexPlayer;
|
|
|
|
@ -27,8 +58,6 @@ namespace TheGameExtreme.model.manager
|
|
|
|
|
protected List<Card> CurrentCardPlayed = new List<Card>();
|
|
|
|
|
protected string langue;
|
|
|
|
|
|
|
|
|
|
protected GameMode gameMode;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
protected GameManager(int nbPlayer, List<String> players)
|
|
|
|
|
{
|
|
|
|
@ -71,19 +100,6 @@ namespace TheGameExtreme.model.manager
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected void initRule()
|
|
|
|
|
{
|
|
|
|
|
gameMode = new GameMode();
|
|
|
|
|
gameMode.addPlayRule(new Ascendant());
|
|
|
|
|
gameMode.addPlayRule(new Descendant());
|
|
|
|
|
gameMode.addPlayRule(new PasDeDix());
|
|
|
|
|
//gameMode.addPlayRule(new VoidHand());
|
|
|
|
|
gameMode.addBeforeEndTurnRule(new NbCardPlay());
|
|
|
|
|
gameMode.addEndTurnRule(new EndGame(ListOrderedStacks));
|
|
|
|
|
//gameMode.addEndTurnRule(new VoidDeck());
|
|
|
|
|
//gameMode.addEndTurnRule(new CompleteHand());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected void createDeck()
|
|
|
|
|
{
|
|
|
|
|
switch (true)
|
|
|
|
@ -159,31 +175,17 @@ namespace TheGameExtreme.model.manager
|
|
|
|
|
|
|
|
|
|
protected void testPossibility(Card card, Stack<Card> orderedStack, bool bottomUp)
|
|
|
|
|
{
|
|
|
|
|
if (gameMode.checkPlayRule(card, orderedStack, bottomUp, CurrentHand))
|
|
|
|
|
{
|
|
|
|
|
Card oldCard = orderedStack.Peek();
|
|
|
|
|
playerList[currentIndexPlayer].joue(card);
|
|
|
|
|
CurrentCardPlayed.Add(card);
|
|
|
|
|
orderedStack.Push(card);
|
|
|
|
|
OnTopRangeChanged(new TopRangeChangedEventArgs(card, oldCard, ListOrderedStacks.IndexOf(orderedStack)));
|
|
|
|
|
//if (CurrentHand.Count == 0)
|
|
|
|
|
//{
|
|
|
|
|
// endTurn(); // Presque bon, oublie juste d'afficher les nouvelles cartes
|
|
|
|
|
//}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
throw new Exception(AppRessource.StrWrongStack);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//if ((bottomUp && card.Value > orderedStack.Peek().Value) || (!bottomUp && card.Value < orderedStack.Peek().Value) || card.Value == orderedStack.Peek().Value + 10 || card.Value == orderedStack.Peek().Value - 10)
|
|
|
|
|
//if (gameMode.checkPlayRule(card, orderedStack, bottomUp, CurrentHand))
|
|
|
|
|
//{
|
|
|
|
|
// Card oldCard = orderedStack.Peek();
|
|
|
|
|
// playerList[currentIndexPlayer].joue(card);
|
|
|
|
|
// CurrentCardPlayed.Add(card);
|
|
|
|
|
// orderedStack.Push(card);
|
|
|
|
|
// OnTopRangeChanged(new TopRangeChangedEventArgs(card, oldCard, ListOrderedStacks.IndexOf(orderedStack)));
|
|
|
|
|
// //if (CurrentHand.Count == 0)
|
|
|
|
|
// //{
|
|
|
|
|
// // endTurn(); // Presque bon, oublie juste d'afficher les nouvelles cartes
|
|
|
|
|
// //}
|
|
|
|
|
//}
|
|
|
|
|
//else
|
|
|
|
|
//{
|
|
|
|
@ -215,8 +217,6 @@ namespace TheGameExtreme.model.manager
|
|
|
|
|
|
|
|
|
|
abstract public bool endTurn();
|
|
|
|
|
|
|
|
|
|
abstract protected void pioche();
|
|
|
|
|
|
|
|
|
|
abstract protected bool isEndGame();
|
|
|
|
|
|
|
|
|
|
abstract protected void tryToFindSoluce(List<Card> playableCard);
|
|
|
|
|