diff --git a/Documentations/Instruction b/Documentations/Instruction index 71a9e64..cf5eaac 100644 --- a/Documentations/Instruction +++ b/Documentations/Instruction @@ -4,11 +4,10 @@ Mono-utilisateur: - Multilangue - Changer les thèmes et les couleurs (en option) - jeu classique pas extreme - - décaler la création du deck et la distribution des cartes dans un stub - Thème dark - Jeu solo complet - Push version sur les stores pour la semaine pro - - Rendre abstract la creation deck + - Rendre abstract la creation deck V - Drag and drop - Option pour mettre/enlever le pas de 10 - Menu de choix de partie @@ -18,6 +17,7 @@ Mono-utilisateur: - Faire une list de règle devant toute être vérifier à chaque carte joué - Faire une list de règle devant toute être vérifier à chaque fin de tour - Skia + - GameMaster implémentera un ModeDeJeu qui implémentera des règles du jeu The game -> déposé? diff --git a/TheGameExtreme/TheGameExtreme.csproj b/TheGameExtreme/TheGameExtreme.csproj index fe9e2e5..f51a7d1 100644 --- a/TheGameExtreme/TheGameExtreme.csproj +++ b/TheGameExtreme/TheGameExtreme.csproj @@ -14,6 +14,10 @@ + + + + diff --git a/TheGameExtreme/model/Card/Card.cs b/TheGameExtreme/model/Card/Card.cs index aa5d061..d5931d0 100644 --- a/TheGameExtreme/model/Card/Card.cs +++ b/TheGameExtreme/model/Card/Card.cs @@ -27,5 +27,8 @@ namespace TheGameExtreme.model.card Value = value; } + public abstract String getName(); + public abstract bool rapidEffect(); + } } diff --git a/TheGameExtreme/model/Card/ClassicCard.cs b/TheGameExtreme/model/Card/ClassicCard.cs index c490f59..559ad26 100644 --- a/TheGameExtreme/model/Card/ClassicCard.cs +++ b/TheGameExtreme/model/Card/ClassicCard.cs @@ -4,9 +4,23 @@ namespace TheGameExtreme.model.card { public class ClassicCard : Card { + + public static readonly String CARD_CLASSIC = "ClassicCard"; + public ClassicCard(int value) : base(value) { } + + public override bool rapidEffect() + { + return false; + } + + override public String getName() + { + return CARD_CLASSIC; + } + } } \ No newline at end of file diff --git a/TheGameExtreme/model/Card/EndGameCard.cs b/TheGameExtreme/model/Card/EndGameCard.cs deleted file mode 100644 index 0595bd0..0000000 --- a/TheGameExtreme/model/Card/EndGameCard.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System; -namespace TheGameExtreme.model.card -{ - public class EndGameCard : Card - { - - public EndGameCard(int value) - :base(value) - { - } - } -} diff --git a/TheGameExtreme/model/Card/ThreeCard.cs b/TheGameExtreme/model/Card/ThreeCard.cs deleted file mode 100644 index 685c010..0000000 --- a/TheGameExtreme/model/Card/ThreeCard.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System; - -namespace TheGameExtreme.model.card -{ - public class ThreeCard : Card - { - public ThreeCard(int value) - :base(value) - { - } - } -} diff --git a/TheGameExtreme/model/Card/rapidCard/EndGameCard.cs b/TheGameExtreme/model/Card/rapidCard/EndGameCard.cs new file mode 100644 index 0000000..be6781b --- /dev/null +++ b/TheGameExtreme/model/Card/rapidCard/EndGameCard.cs @@ -0,0 +1,20 @@ +using System; +namespace TheGameExtreme.model.card.rapidCard +{ + public class EndGameCard : RapidCard + { + + public static readonly String CARD_ENDGAME = "EndGameCard"; + + public EndGameCard(int value) + :base(value) + { + } + + override public String getName() + { + return CARD_ENDGAME; + } + + } +} diff --git a/TheGameExtreme/model/Card/rapidCard/RapidCard.cs b/TheGameExtreme/model/Card/rapidCard/RapidCard.cs new file mode 100644 index 0000000..b3bc178 --- /dev/null +++ b/TheGameExtreme/model/Card/rapidCard/RapidCard.cs @@ -0,0 +1,16 @@ +using System; +namespace TheGameExtreme.model.card.rapidCard +{ + public abstract class RapidCard : Card + { + public RapidCard(int value) : base(value) + { + } + + public override bool rapidEffect() + { + return true; + } + + } +} diff --git a/TheGameExtreme/model/Card/rapidCard/ThreeCard.cs b/TheGameExtreme/model/Card/rapidCard/ThreeCard.cs new file mode 100644 index 0000000..6c64d5f --- /dev/null +++ b/TheGameExtreme/model/Card/rapidCard/ThreeCard.cs @@ -0,0 +1,21 @@ +using System; + +namespace TheGameExtreme.model.card.rapidCard +{ + public class ThreeCard : RapidCard + { + + public static readonly String CARD_THREE = "ThreeCard"; + + public ThreeCard(int value) + :base(value) + { + } + + override public String getName() + { + return CARD_THREE; + } + + } +} diff --git a/TheGameExtreme/model/GameMode.cs b/TheGameExtreme/model/GameMode.cs new file mode 100644 index 0000000..9576b3b --- /dev/null +++ b/TheGameExtreme/model/GameMode.cs @@ -0,0 +1,62 @@ +using System; +using System.Collections.Generic; +using TheGameExtreme.model.rule; +using TheGameExtreme.model.rule.endRule; +using TheGameExtreme.model.rule.playRules; + +namespace TheGameExtreme.model +{ + public class GameMode + { + + private List playRule = new List(); + private List endTurnRule = new List(); + private List commonRule = new List(); + + public GameMode() + { + } + + public void addPlayRule(PlayRule rule) + { + playRule?.Add(rule); + } + + public void addEndTurnRule(EndTurnRule rule) + { + endTurnRule?.Add(rule); + } + + public void addCommonRule(Rule rule) + { + // Vérifier que se ne soit ni une PlayRule, ni une EndTurnRule ? + commonRule?.Add(rule); + } + + public bool testPlayRule() + { + foreach(PlayRule rule in playRule) + { + + } + foreach (Rule rule in commonRule) + { + + } + return true; + } + + public bool testEndTurnRule() + { + foreach (EndTurnRule rule in endTurnRule) + { + + } + foreach (Rule rule in commonRule) + { + + } + return true; + } + } +} diff --git a/TheGameExtreme/model/deck/ExtremeDeck.cs b/TheGameExtreme/model/deck/ExtremeDeck.cs index 06f2aa0..bf191f4 100644 --- a/TheGameExtreme/model/deck/ExtremeDeck.cs +++ b/TheGameExtreme/model/deck/ExtremeDeck.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using TheGameExtreme.model.card; +using TheGameExtreme.model.card.rapidCard; namespace TheGameExtreme.model.deck { diff --git a/TheGameExtreme/model/manager/SoloGameManager.cs b/TheGameExtreme/model/manager/SoloGameManager.cs index 6a2df8f..28cbd15 100644 --- a/TheGameExtreme/model/manager/SoloGameManager.cs +++ b/TheGameExtreme/model/manager/SoloGameManager.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using TheGameExtreme.model.card; +using TheGameExtreme.model.card.rapidCard; using TheGameExtreme.model.@event; namespace TheGameExtreme.model.manager @@ -43,7 +44,7 @@ namespace TheGameExtreme.model.manager { foreach (Card cardPlayed in CurrentCardPlayed) { - if (cardPlayed.GetType() == typeof(ThreeCard)) + if (Equals(cardPlayed.GetType(), ThreeCard.CARD_THREE)) { if ((nbCardAtBeginOfTurn - CurrentHand.Count) < 3) // Penser à vérifier s'il a joué une ThreeCard pour regarder s'il a bien joué 3 cartes { @@ -123,7 +124,7 @@ namespace TheGameExtreme.model.manager { foreach (Card c in playableCard) { - if (c.Equals(typeof(ThreeCard))) + if (Equals(c.getName(), ThreeCard.CARD_THREE)) { win = false; EndMessage = "Le jeu est terminé!\n Désolé, vous avez perdu... Vous deviez jouer trois cartes à cause de l'effet \"Trois cartes joué\" hors votre jeu ne permet pas d'en jouer autant! Essayez encore!"; @@ -151,7 +152,7 @@ namespace TheGameExtreme.model.manager { foreach (Stack orderedStack in ListOrderedStacks) { - if (orderedStack.Peek().GetType() == typeof(EndGameCard)) + if (Equals(orderedStack.Peek().getName(), EndGameCard.CARD_ENDGAME)) { return true; } diff --git a/TheGameExtreme/model/rule/InfinitEffect.cs b/TheGameExtreme/model/rule/InfinitEffect.cs new file mode 100644 index 0000000..c7a4896 --- /dev/null +++ b/TheGameExtreme/model/rule/InfinitEffect.cs @@ -0,0 +1,10 @@ +using System; +namespace TheGameExtreme.model.rule +{ + public class InfinitEffect : Rule + { + public InfinitEffect() + { + } + } +} diff --git a/TheGameExtreme/model/rule/RapidEffect.cs b/TheGameExtreme/model/rule/RapidEffect.cs new file mode 100644 index 0000000..9b7d60f --- /dev/null +++ b/TheGameExtreme/model/rule/RapidEffect.cs @@ -0,0 +1,10 @@ +using System; +namespace TheGameExtreme.model.rule +{ + public class RapidEffect : Rule + { + public RapidEffect() + { + } + } +} diff --git a/TheGameExtreme/model/rule/Rule.cs b/TheGameExtreme/model/rule/Rule.cs new file mode 100644 index 0000000..5d9d5ee --- /dev/null +++ b/TheGameExtreme/model/rule/Rule.cs @@ -0,0 +1,19 @@ +using System; +using TheGameExtreme.model.card; + +namespace TheGameExtreme.model.rule +{ + public abstract class Rule + { + + public Rule() + { + } + + public bool Test() + { + throw new NotImplementedException(); + } + + } +} diff --git a/TheGameExtreme/model/rule/endRule/EndGame.cs b/TheGameExtreme/model/rule/endRule/EndGame.cs new file mode 100644 index 0000000..93e0d9c --- /dev/null +++ b/TheGameExtreme/model/rule/endRule/EndGame.cs @@ -0,0 +1,11 @@ +using System; + +namespace TheGameExtreme.model.rule.endRule +{ + public class EndGame : EndTurnRule + { + public EndGame() + { + } + } +} diff --git a/TheGameExtreme/model/rule/endRule/EndTurnRule.cs b/TheGameExtreme/model/rule/endRule/EndTurnRule.cs new file mode 100644 index 0000000..4b28fb1 --- /dev/null +++ b/TheGameExtreme/model/rule/endRule/EndTurnRule.cs @@ -0,0 +1,11 @@ +using System; + +namespace TheGameExtreme.model.rule.endRule +{ + public abstract class EndTurnRule : Rule + { + public EndTurnRule() + { + } + } +} diff --git a/TheGameExtreme/model/rule/endRule/VoidDeck.cs b/TheGameExtreme/model/rule/endRule/VoidDeck.cs new file mode 100644 index 0000000..fea39d1 --- /dev/null +++ b/TheGameExtreme/model/rule/endRule/VoidDeck.cs @@ -0,0 +1,10 @@ +using System; +namespace TheGameExtreme.model.rule.endRule +{ + public class VoidDeck : EndTurnRule + { + public VoidDeck() + { + } + } +} diff --git a/TheGameExtreme/model/rule/endRule/VoidHand.cs b/TheGameExtreme/model/rule/endRule/VoidHand.cs new file mode 100644 index 0000000..fa595e6 --- /dev/null +++ b/TheGameExtreme/model/rule/endRule/VoidHand.cs @@ -0,0 +1,10 @@ +using System; +namespace TheGameExtreme.model.rule.endRule +{ + public class VoidHand : EndTurnRule + { + public VoidHand() + { + } + } +} diff --git a/TheGameExtreme/model/rule/playRules/Ascendant.cs b/TheGameExtreme/model/rule/playRules/Ascendant.cs new file mode 100644 index 0000000..109c3ce --- /dev/null +++ b/TheGameExtreme/model/rule/playRules/Ascendant.cs @@ -0,0 +1,25 @@ +using System; +using TheGameExtreme.model.card; + +namespace TheGameExtreme.model.rule.playRules +{ + public class Ascendant : PlayRule + { + + public static readonly String REGLE_ASCENDANT = "Ascendant"; + + public Ascendant() + { + } + + public bool Test(Card upStack, Card playedCard, bool bottomUp) + { + if (bottomUp && playedCard.Value > upStack.Value) + { + return true; + } + return false; + } + + } +} diff --git a/TheGameExtreme/model/rule/playRules/Descendant.cs b/TheGameExtreme/model/rule/playRules/Descendant.cs new file mode 100644 index 0000000..c114d8e --- /dev/null +++ b/TheGameExtreme/model/rule/playRules/Descendant.cs @@ -0,0 +1,24 @@ +using System; +using TheGameExtreme.model.card; + +namespace TheGameExtreme.model.rule.playRules +{ + public class Descendant : PlayRule + { + + public static readonly String REGLE_DESCENDANT = "Descendant"; + + public Descendant() + { + } + + public bool Test(Card upStack, Card playedCard, bool bottomUp) + { + if (bottomUp && playedCard.Value > upStack.Value) + { + return true; + } + return false; + } + } +} \ No newline at end of file diff --git a/TheGameExtreme/model/rule/playRules/PasDeDix.cs b/TheGameExtreme/model/rule/playRules/PasDeDix.cs new file mode 100644 index 0000000..bc23085 --- /dev/null +++ b/TheGameExtreme/model/rule/playRules/PasDeDix.cs @@ -0,0 +1,25 @@ +using System; +using TheGameExtreme.model.card; + +namespace TheGameExtreme.model.rule.playRules +{ + public class PasDeDix : PlayRule + { + + public static readonly String REGLE_PASDEDIX = "PasDeDix"; + + public PasDeDix() + { + } + + public bool Test(Card upStack, Card playedCard) + { + if ((upStack.Value + 10) == playedCard.Value || (upStack.Value - 10) == playedCard.Value) + { + return true; + } + return false; + } + + } +} diff --git a/TheGameExtreme/model/rule/playRules/PlayRule.cs b/TheGameExtreme/model/rule/playRules/PlayRule.cs new file mode 100644 index 0000000..c239bd3 --- /dev/null +++ b/TheGameExtreme/model/rule/playRules/PlayRule.cs @@ -0,0 +1,11 @@ +using System; +namespace TheGameExtreme.model.rule.playRules +{ + public class PlayRule : Rule + { + + public PlayRule() + { + } + } +} diff --git a/TheGameExtreme/view/MainPage.xaml b/TheGameExtreme/view/MainPage.xaml index 9ba2b2b..9c74626 100644 --- a/TheGameExtreme/view/MainPage.xaml +++ b/TheGameExtreme/view/MainPage.xaml @@ -79,7 +79,7 @@ x:Name="botPanel" Orientation="Vertical" Margin="20"> -