From 5a8d87b908cc9451115f8888e89b033c8171ce73 Mon Sep 17 00:00:00 2001 From: Lynne Date: Thu, 10 Sep 2020 03:13:18 +1000 Subject: [PATCH] now they have species! 0u0 --- Creacher.cs | 16 ++++++++++------ Program.cs | 19 +++++++++++++------ 2 files changed, 23 insertions(+), 12 deletions(-) diff --git a/Creacher.cs b/Creacher.cs index 63bbeac..b1bc60c 100644 --- a/Creacher.cs +++ b/Creacher.cs @@ -19,15 +19,19 @@ namespace wikicreachia { } class Creacher { - public string name { get; set; } + private string _name; + public string name { get { return this._name[0].ToString().ToUpper() + this._name.Substring(1); } set { this._name = value; } } + public string species { get; set; } public string biome { get; set; } public int footsies { get; set; } public Locomotion locomotion { get; set; } public RelativeElevation elevation { get; set; } - public Creacher(string name, int footsies, string biome, Locomotion locomotion, RelativeElevation elevation) { + public Creacher(string name, string species, int footsies, string biome, Locomotion locomotion, RelativeElevation elevation) { this.name = name; + this.species = species; this.footsies = footsies; + this.biome = biome; this.locomotion = locomotion; this.elevation = elevation; } @@ -41,10 +45,10 @@ namespace wikicreachia { return list[rng.Next(list.Count)]; } string RandomCompliment() { - return RandomItem(new List { "wonderful", "gorgeous", "spectacular", "iconic", "precious", "amazing", "incredible", "wondrous", "fantastic", "impeccable", "admirable", "long" }); + return RandomItem(new List { "wonderful", "gorgeous", "spectacular", "iconic", "precious", "amazing", "incredible", "wondrous", "fantastic", "impeccable", "admirable", "long", "precious" }); } - string output = RandomItem(new List { "Coming up next, we have", "And here we have", "Oh look, it's", "Here comes that", "Look out! It's" }); + string output = RandomItem(new List { "Coming up next, we have", "And here we have", "Oh look, it's", "Here comes", "Look out! It's" }); output += $" {this.name}! With "; if (this.footsies > 5) { output += $"a whopping {this.footsies} footsies"; @@ -55,9 +59,9 @@ namespace wikicreachia { else { output += "not one footsy in sight"; } - output += $", this {RandomCompliment()} creacher "; + output += $", this {RandomCompliment()} {this.species} "; output += RandomItem(new List { "usually finds itself in the", "makes its home in the", "truly rules the", "will often be found in the", "loves the", "can't get enough of the", "finds itself most comfortable in the" }); - output += $" {this.biome}. The {this.name} is a {RandomCompliment()} {this.locomotion}, usually found {this.elevation.ToString().ToLower()} sea level. "; + output += $" {this.biome}. {this.name} is a {RandomCompliment()} {this.locomotion}, usually found {this.elevation.ToString().ToLower()} sea level. "; output += RandomItem(new List { "Isn't it", "Truly", "Simply", "Absolutely", "Definitively", "Inspiringly", "Indescribably" }); output += $" {RandomCompliment()}."; return output; diff --git a/Program.cs b/Program.cs index f434951..ad9b78c 100644 --- a/Program.cs +++ b/Program.cs @@ -30,16 +30,17 @@ namespace wikicreachia { break; case "add": - if (status.minor <= 2) { + if (status.minor <= 3) { string[] prompts = { "Input the name of your creacher, or 'c' to cancel.", + "Input the species of your creacher.", "Input the desired number of footsies (number).", "Input the biome your creacher inhabits most often (freeform text).", }; prompt = prompts[status.minor]; } - else if (status.minor == 3) { + else if (status.minor == 4) { prompt = "Press the number corresponding to your creacher's primary method of locomotion:"; foreach (Locomotion option in Enum.GetValues(typeof(Locomotion))) { prompt += $"\n{(int)option + 1}. {option}"; @@ -47,7 +48,7 @@ namespace wikicreachia { readKey = true; } - else if (status.minor == 4) { + else if (status.minor == 5) { prompt = "Press the number corresponding to the elevation level your creacher is usually found at:\n1. Below sea level\n2. At sea level\n3. Above sea level"; readKey = true; } @@ -141,6 +142,11 @@ namespace wikicreachia { } else if (status.minor == 1) { + userCreacher["species"] = input; + status.minor++; + } + + else if (status.minor == 2) { if (int.TryParse(input, out int footsies) && footsies >= 0) { userCreacher["footsies"] = footsies; status.minor++; @@ -150,12 +156,12 @@ namespace wikicreachia { } } - else if (status.minor == 2) { + else if (status.minor == 3) { userCreacher["biome"] = input; status.minor++; } - else if (status.minor == 3) { + else if (status.minor == 4) { if (int.TryParse(input, out int choice) && Enum.IsDefined(typeof(Locomotion), choice - 1)) { userCreacher["locomotion"] = (Locomotion)choice - 1; status.minor++; @@ -165,7 +171,7 @@ namespace wikicreachia { } } - else if (status.minor == 4) { + else if (status.minor == 5) { if (int.TryParse(input, out int choice) && Enum.IsDefined(typeof(RelativeElevation), choice - 1)) { userCreacher["elevation"] = (RelativeElevation)choice - 1; @@ -173,6 +179,7 @@ namespace wikicreachia { creachers.Add( (string)userCreacher["name"], new Creacher( (string)userCreacher["name"], + (string)userCreacher["species"], (int)userCreacher["footsies"], (string)userCreacher["biome"], (Locomotion)userCreacher["locomotion"],