finished creach addition, added case for 1 footsie

This commit is contained in:
Pecha 2020-09-13 00:34:29 +10:00
parent d03ccb755e
commit 7c692f0369
10 changed files with 60 additions and 19 deletions

2
.vscode/launch.json vendored
View file

@ -14,7 +14,7 @@
"args": [],
"cwd": "${workspaceFolder}",
// For more information about the 'console' field, see https://aka.ms/VSCode-CS-LaunchJson-Console
"console": "internalConsole",
"console": "integratedTerminal",
"stopAtEntry": false
},
{

View file

@ -43,6 +43,8 @@ namespace creachopedia {
if(this.footsies == 0){
Console.WriteLine("I cannot stip or step! I have 0 footsies! I am however quite powerful in my own way 0u0");
Console.WriteLine("Silly creacher...");
} else if(footsies == 1){
Console.WriteLine($"The {this.name} only has 1 footsie, but it does its best.");
} else {
Console.WriteLine($"The {this.name} steps, and rather well I might add.");
}

View file

@ -13,14 +13,18 @@ namespace creachopedia {
var substatus = 1;
var tempdict = new Dictionary<string, string>();
var creacherdict = JsonConvert.DeserializeObject<Dictionary<string, Creacher>>(File.ReadAllText("creachopedia.json"));
// creacherdict.Add("paca", new GroundCreacher("paca", 4));
// creacherdict.Add("llama", new GroundCreacher("llama", 4));
// creacherdict.Add("stingray", new WaterCreacher("stingray", 0));
// var jsonsettings = new JsonSerializerSettings{
// TypeNameHandling = TypeNameHandling.Auto
// };
// string jsonstring = JsonConvert.SerializeObject(creacherdict, Formatting.Indented, jsonsettings);
// File.WriteAllText("creachopedia.json", jsonstring);
var shortdefs = new Dictionary<string, string>(){
{"a", "At"},
{"b", "Below"},
{"v", "Above"},
{"n", "None"},
{"w", "Walker"},
{"s", "Swimmer"},
{"h", "Hopper"},
{"f", "Flier"},
{"l", "Slitherer"},
{"i", "Incher"}
};
while (true) {
@ -46,6 +50,8 @@ namespace creachopedia {
case 5:
Console.WriteLine("Please enter your creacher's relation to the surface: [b]elow, [a]t, abo[v]e");
break;
case 6:
break;
}
break;
}
@ -122,13 +128,18 @@ namespace creachopedia {
tempdict.Add("surfacerel", luserin);
substatus++;
}
else {
Console.WriteLine("Sorry, this surface relation did not match one of the three listed above. Please try again.");
}
}
else if (substatus == 6) {
return;
Console.WriteLine("test0");
var tempcreach = new Creacher(tempdict["name"], int.Parse(tempdict["footsies"]), tempdict["biome"], (Locomotion)Enum.Parse(typeof(Locomotion), shortdefs[tempdict["locomethod"]]), (SurfaceRel)Enum.Parse(typeof(SurfaceRel), shortdefs[tempdict["surfacerel"]]));
creacherdict.Add(tempdict["name"], tempcreach);
File.WriteAllText("creachopedia.json", JsonConvert.SerializeObject(creacherdict, Formatting.Indented));
Console.WriteLine("Creacher adde! 0u0");
status = "base";
substatus = 1;
}
foreach (var i in tempdict) {
Console.WriteLine("{0}:{1}", i.Key, i.Value);
@ -136,7 +147,7 @@ namespace creachopedia {
}
Console.WriteLine("");
Thread.Sleep(1000);
Thread.Sleep(500);
}
}
}

View file

@ -1,20 +1,22 @@
{
"paca": {
"$type": "creachopedia.GroundCreacher, creachopedia",
"type": "creacher of the land",
"name": "paca",
"_footsies": 4
},
"llama": {
"$type": "creachopedia.GroundCreacher, creachopedia",
"type": "creacher of the land",
"name": "llama",
"_footsies": 4
},
"stingray": {
"$type": "creachopedia.WaterCreacher, creachopedia",
"type": "creacher of the water",
"name": "stingray",
"_footsies": 0
},
"Snool": {
"type": "creacher of the urban",
"name": "Snool",
"_footsies": 1
}
}

20
json.bak Normal file
View file

@ -0,0 +1,20 @@
{
"paca": {
"$type": "creachopedia.GroundCreacher, creachopedia",
"type": "creacher of the land",
"name": "paca",
"_footsies": 4
},
"llama": {
"$type": "creachopedia.GroundCreacher, creachopedia",
"type": "creacher of the land",
"name": "llama",
"_footsies": 4
},
"stingray": {
"$type": "creachopedia.WaterCreacher, creachopedia",
"type": "creacher of the water",
"name": "stingray",
"_footsies": 0
}
}

View file

@ -1,4 +1,10 @@
name, footsycount, biome///, locomotion, surfacerel,
name, footsycount, biome, locomotion, surfacerel,
None, Walker, Swimmer, Hopper, Flier, Slitherer, Incher
FOR NEXT VERSION:
- individuals/species distinction
- ability to add individuals without a previously-created species by creating them together
- maybe get rid of Newtonsoft JSON stuff- polymorphism no longer necessary w/ sunsetting of inheritance