From 1c87f5de162fc058c7a9416707125860d95efb61 Mon Sep 17 00:00:00 2001 From: Knose Date: Sat, 31 Jul 2021 13:57:03 +0200 Subject: [PATCH] Add tarot cards keywords, empty for now --- Classes/ICard.cs | 4 +- Classes/TarotCard.cs | 11 +- Classes/TarotDeck.cs | 2 +- Classes/TarotSpread.cs | 2 +- Data/default_cards.json | 390 ++++++++++++++++++++++++++++++++-------- Options.cs | 5 +- Program.cs | 4 +- TODO.md | 6 +- 8 files changed, 337 insertions(+), 87 deletions(-) diff --git a/Classes/ICard.cs b/Classes/ICard.cs index 922b895..68bffd4 100644 --- a/Classes/ICard.cs +++ b/Classes/ICard.cs @@ -2,6 +2,8 @@ namespace tarot{ public interface ICard{ - public String ToString(); + public String GetName(); + + public String GetKeywords(); } } \ No newline at end of file diff --git a/Classes/TarotCard.cs b/Classes/TarotCard.cs index b11c23e..471fced 100644 --- a/Classes/TarotCard.cs +++ b/Classes/TarotCard.cs @@ -1,12 +1,19 @@ namespace tarot{ public class TarotCard : ICard{ public readonly string Name; - public TarotCard(string name){ + public readonly string Keywords; + + public TarotCard(string name, string keywords){ this.Name = name; + this.Keywords = keywords; } - public override string ToString(){ + public string GetName(){ return Name; } + + public string GetKeywords(){ + return Keywords; + } } } \ No newline at end of file diff --git a/Classes/TarotDeck.cs b/Classes/TarotDeck.cs index fbd6833..cb3bd29 100644 --- a/Classes/TarotDeck.cs +++ b/Classes/TarotDeck.cs @@ -31,7 +31,7 @@ public TarotCard RequeueCard() { public void PrintDeck(){ foreach(TarotCard card in this._deck){ - Console.WriteLine(card.ToString()); + Console.WriteLine(card.GetName()); } } diff --git a/Classes/TarotSpread.cs b/Classes/TarotSpread.cs index 71b0189..37dc530 100644 --- a/Classes/TarotSpread.cs +++ b/Classes/TarotSpread.cs @@ -2,7 +2,7 @@ namespace tarot{ public class TarotSpread : ISpread{ - public string[] Positions; + public readonly string[] Positions; private TarotCard[] _spread_cards; diff --git a/Data/default_cards.json b/Data/default_cards.json index 128f779..28ba368 100644 --- a/Data/default_cards.json +++ b/Data/default_cards.json @@ -1,84 +1,318 @@ [ - {"Name": "0 The Fool"}, - {"Name": "I The Magician"}, - {"Name": "II The High Priestess"}, - {"Name": "III The Empress"}, - {"Name": "IV The Emperor"}, - {"Name": "V The Hierophant"}, - {"Name": "VI The Lovers"}, - {"Name": "VII The Chariot"}, - {"Name": "VIII Strength"}, - {"Name": "IX The Hermit"}, - {"Name": "X Wheel of Fortune"}, - {"Name": "XI Justice"}, - {"Name": "XII The Hanged Man"}, - {"Name": "XIII Death"}, - {"Name": "XIV Temperance"}, - {"Name": "XV The Devil"}, - {"Name": "XVI The Tower"}, - {"Name": "XVII The Star"}, - {"Name": "XVIII The Moon"}, - {"Name": "XIX The Sun"}, - {"Name": "XX Judgement"}, - {"Name": "XXI The World"}, + { + "Name": "0 The Fool", + "Keywords": "" + }, + { + "Name": "I The Magician", + "Keywords": "" + }, + { + "Name": "II The High Priestess", + "Keywords": "" + }, + { + "Name": "III The Empress", + "Keywords": "" + }, + { + "Name": "IV The Emperor", + "Keywords": "" + }, + { + "Name": "V The Hierophant", + "Keywords": "" + }, + { + "Name": "VI The Lovers", + "Keywords": "" + }, + { + "Name": "VII The Chariot", + "Keywords": "" + }, + { + "Name": "VIII Strength", + "Keywords": "" + }, + { + "Name": "IX The Hermit", + "Keywords": "" + }, + { + "Name": "X Wheel of Fortune", + "Keywords": "" + }, + { + "Name": "XI Justice", + "Keywords": "" + }, + { + "Name": "XII The Hanged Man", + "Keywords": "" + }, + { + "Name": "XIII Death", + "Keywords": "" + }, + { + "Name": "XIV Temperance", + "Keywords": "" + }, + { + "Name": "XV The Devil", + "Keywords": "" + }, + { + "Name": "XVI The Tower", + "Keywords": "" + }, + { + "Name": "XVII The Star", + "Keywords": "" + }, + { + "Name": "XVIII The Moon", + "Keywords": "" + }, + { + "Name": "XIX The Sun", + "Keywords": "" + }, + { + "Name": "XX Judgement", + "Keywords": "" + }, + { + "Name": "XXI The World", + "Keywords": "" + }, - {"Name": "Ace of Staffs"}, - {"Name": "Two of Staffs"}, - {"Name": "Three of Staffs"}, - {"Name": "Four of Staffs"}, - {"Name": "Five of Staffs"}, - {"Name": "Six of Staffs"}, - {"Name": "Seven of Staffs"}, - {"Name": "Eight of Staffs"}, - {"Name": "Nine of Staffs"}, - {"Name": "Ten of Staffs"}, - {"Name": "Page of Staffs"}, - {"Name": "Knight of Staffs"}, - {"Name": "Queen of Staffs"}, - {"Name": "King of Staffs"}, + { + "Name": "Ace of Staffs", + "Keywords": "" + }, + { + "Name": "Two of Staffs", + "Keywords": "" + }, + { + "Name": "Three of Staffs", + "Keywords": "" + }, + { + "Name": "Four of Staffs", + "Keywords": "" + }, + { + "Name": "Five of Staffs", + "Keywords": "" + }, + { + "Name": "Six of Staffs", + "Keywords": "" + }, + { + "Name": "Seven of Staffs", + "Keywords": "" + }, + { + "Name": "Eight of Staffs", + "Keywords": "" + }, + { + "Name": "Nine of Staffs", + "Keywords": "" + }, + { + "Name": "Ten of Staffs", + "Keywords": "" + }, + { + "Name": "Page of Staffs", + "Keywords": "" + }, + { + "Name": "Knight of Staffs", + "Keywords": "" + }, + { + "Name": "Queen of Staffs", + "Keywords": "" + }, + { + "Name": "King of Staffs", + "Keywords": "" + }, - {"Name": "Ace of Cups"}, - {"Name": "Two of Cups"}, - {"Name": "Three of Cups"}, - {"Name": "Four of Cups"}, - {"Name": "Five of Cups"}, - {"Name": "Six of Cups"}, - {"Name": "Seven of Cups"}, - {"Name": "Eight of Cups"}, - {"Name": "Nine of Cups"}, - {"Name": "Ten of Cups"}, - {"Name": "Page of Cups"}, - {"Name": "Knight of Cups"}, - {"Name": "Queen of Cups"}, - {"Name": "King of Cups"}, + { + "Name": "Ace of Cups", + "Keywords": "" + }, + { + "Name": "Two of Cups", + "Keywords": "" + }, + { + "Name": "Three of Cups", + "Keywords": "" + }, + { + "Name": "Four of Cups", + "Keywords": "" + }, + { + "Name": "Five of Cups", + "Keywords": "" + }, + { + "Name": "Six of Cups", + "Keywords": "" + }, + { + "Name": "Seven of Cups", + "Keywords": "" + }, + { + "Name": "Eight of Cups", + "Keywords": "" + }, + { + "Name": "Nine of Cups", + "Keywords": "" + }, + { + "Name": "Ten of Cups", + "Keywords": "" + }, + { + "Name": "Page of Cups", + "Keywords": "" + }, + { + "Name": "Knight of Cups", + "Keywords": "" + }, + { + "Name": "Queen of Cups", + "Keywords": "" + }, + { + "Name": "King of Cups", + "Keywords": "" + }, - {"Name": "Ace of Swords"}, - {"Name": "Two of Swords"}, - {"Name": "Three of Swords"}, - {"Name": "Four of Swords"}, - {"Name": "Five of Swords"}, - {"Name": "Six of Swords"}, - {"Name": "Seven of Swords"}, - {"Name": "Eight of Swords"}, - {"Name": "Nine of Swords"}, - {"Name": "Ten of Swords"}, - {"Name": "Page of Swords"}, - {"Name": "Knight of Swords"}, - {"Name": "Queen of Swords"}, - {"Name": "King of Swords"}, + { + "Name": "Ace of Swords", + "Keywords": "" + }, + { + "Name": "Two of Swords", + "Keywords": "" + }, + { + "Name": "Three of Swords", + "Keywords": "" + }, + { + "Name": "Four of Swords", + "Keywords": "" + }, + { + "Name": "Five of Swords", + "Keywords": "" + }, + { + "Name": "Six of Swords", + "Keywords": "" + }, + { + "Name": "Seven of Swords", + "Keywords": "" + }, + { + "Name": "Eight of Swords", + "Keywords": "" + }, + { + "Name": "Nine of Swords", + "Keywords": "" + }, + { + "Name": "Ten of Swords", + "Keywords": "" + }, + { + "Name": "Page of Swords", + "Keywords": "" + }, + { + "Name": "Knight of Swords", + "Keywords": "" + }, + { + "Name": "Queen of Swords", + "Keywords": "" + }, + { + "Name": "King of Swords", + "Keywords": "" + }, - {"Name": "Ace of Pentacles"}, - {"Name": "Two of Pentacles"}, - {"Name": "Three of Pentacles"}, - {"Name": "Four of Pentacles"}, - {"Name": "Five of Pentacles"}, - {"Name": "Six of Pentacles"}, - {"Name": "Seven of Pentacles"}, - {"Name": "Eight of Pentacles"}, - {"Name": "Nine of Pentacles"}, - {"Name": "Ten of Pentacles"}, - {"Name": "Page of Pentacles"}, - {"Name": "Knight of Pentacles"}, - {"Name": "Queen of Pentacles"}, - {"Name": "King of Pentacles"} + { + "Name": "Ace of Pentacles", + "Keywords": "" + }, + { + "Name": "Two of Pentacles", + "Keywords": "" + }, + { + "Name": "Three of Pentacles", + "Keywords": "" + }, + { + "Name": "Four of Pentacles", + "Keywords": "" + }, + { + "Name": "Five of Pentacles", + "Keywords": "" + }, + { + "Name": "Six of Pentacles", + "Keywords": "" + }, + { + "Name": "Seven of Pentacles", + "Keywords": "" + }, + { + "Name": "Eight of Pentacles", + "Keywords": "" + }, + { + "Name": "Nine of Pentacles", + "Keywords": "" + }, + { + "Name": "Ten of Pentacles", + "Keywords": "" + }, + { + "Name": "Page of Pentacles", + "Keywords": "" + }, + { + "Name": "Knight of Pentacles", + "Keywords": "" + }, + { + "Name": "Queen of Pentacles", + "Keywords": "" + }, + { + "Name": "King of Pentacles", + "Keywords": "" + } ] \ No newline at end of file diff --git a/Options.cs b/Options.cs index 615cc3f..42cc5c4 100644 --- a/Options.cs +++ b/Options.cs @@ -5,6 +5,9 @@ namespace tarot{ public class GetOptions{ [Value(0, MetaName = "amount", MetaValue = "uint", Required = false, Default = 1u, HelpText = "Amount of cards to retrieve.")] public uint Amount{get; set;} + + [Option('k',"keywords", HelpText = "Print out keywords related to the retrieved cards.")] + public bool Keywords{get; set;} } [Verb("shuffle", HelpText = "Shuffle the deck.")] @@ -39,7 +42,7 @@ public class SpreadOptions{ [Option('a',"list-all", SetName = "all", Required = false, HelpText = "List all spreads.")] public bool ListAll{get; set;} - [Value(0, MetaName = "name", MetaValue = "string", Required = false, Default = "", HelpText = "Name of spread to perform.")] + [Value(0, MetaName = "name", MetaValue = "string", Required = false, HelpText = "Name of spread to perform.")] public string Name{get; set;} } } \ No newline at end of file diff --git a/Program.cs b/Program.cs index 57ba765..295e18d 100644 --- a/Program.cs +++ b/Program.cs @@ -82,7 +82,9 @@ static void SaveDeck(TarotDeck deck){ private static int Get(GetOptions options, TarotDeck deck){ options.Amount = Math.Max(1, options.Amount); for (int i = 0; i < options.Amount; i++){ - Console.WriteLine(deck.RequeueCard().ToString()); + TarotCard card = deck.RequeueCard(); + Console.WriteLine(card.GetName()); + if(options.Keywords) Console.WriteLine($"\tKeywords: {card.GetKeywords()}"); } SaveDeck(deck); return 0; diff --git a/TODO.md b/TODO.md index f9c301a..fc231ea 100644 --- a/TODO.md +++ b/TODO.md @@ -12,19 +12,21 @@ C# Tarot-reading application ### Todo - [ ] Flags for retrieving in .json-format. -- [ ] Add tarot card meanings/keywords. - [ ] Customize help. -- [ ] Create a Minor Arcana creator (If type is minor arcana in .json, create an entire range of that suit (X of "Name")). - [ ] Commands to swap, or insert cards at specific positions in deck, for posibility to do interactive shuffling.. +- [ ] Add option for drawing reverse cards - [ ] ⚠️Refactor input-handling. +- [ ] ⚠️Add documentation - [ ] ⚠️Rework shuffling. - [ ] 🐞Error-handling for parsing/saving files ### In Progress +- [ ] Move listing spreads and viewing one single spread to a verb that also allows viewing a specific card or all cards ### Done ✓ +- [x] Add tarot card meanings/keywords. - [x] Function to reset deck and/or spreads, either from original or from own chosen file. - [x] Current Spreads-file, similar to current deck.