private static void GetParentItems() { string itemName = AskItemName(); Console.WriteLine(); if (itemName.Equals("cancel")) { Console.WriteLine("Search cancelled."); Console.WriteLine(); return; } else { Crafter crafter = ctx.Crafters.ToList().Find(c => c.Kid.Name.Equals(itemName)); if (crafter != null) { if (crafter.Researched) { if (crafter.Mom != null) { if (crafter.Dad != null) { Console.WriteLine($"To make {crafter.KidsMade} {itemName} you need {crafter.MomsNeeded} {crafter.Mom.Name} and {crafter.DadsNeeded} {crafter.Dad.Name}."); } else { Console.WriteLine($"To make {crafter.KidsMade} {itemName} you need {crafter.MomsNeeded} {crafter.Mom.Name}."); } } else { Console.WriteLine($"{itemName} is a starting item. You make {crafter.KidsMade} per cycle per level."); } return; } else { Console.WriteLine("This item has not been researched yet."); Console.WriteLine(); GetParentItems(); } } else { Console.WriteLine("This is not an item."); Console.WriteLine(); GetParentItems(); } } }
protected override void Seed(MyDbContext ctx) { currTier = 1; baseCost = 1; costMult = 1.1; costIncr = 1.05; multIncr = 1.01; tierCostMult = 2; tierCostIncr = 1.5; id = 1; #region Tier 1 #region Air Item air = newItem("Air", true); ctx.Items.Add(air); Crafter airCrafter = newCrafter(air, researched: true); ctx.Crafters.Add(airCrafter); #endregion Air NextId(); #region Earth Item earth = newItem("Earth", true); ctx.Items.Add(earth); Crafter earthCrafter = newCrafter(earth, researched: true); ctx.Crafters.Add(earthCrafter); #endregion Earth NextId(); #region Fire Item fire = newItem("Fire", true); ctx.Items.Add(fire); Crafter fireCrafter = newCrafter(fire, researched: true); ctx.Crafters.Add(fireCrafter); #endregion Fire NextId(); #region Water Item water = newItem("Water", true); ctx.Items.Add(water); Crafter waterCrafter = newCrafter(fire, researched: true); ctx.Crafters.Add(waterCrafter); #endregion Water #endregion Tier 1 NextTier(); #region Tier 2 #region Energy Item energy = newItem("Energy"); ctx.Items.Add(energy); Crafter energyCrafter = newCrafter(energy, mom: air, dad: fire); ctx.Crafters.Add(energyCrafter); #endregion Energy NextId(); #region Lava Item lava = newItem("Lava"); ctx.Items.Add(lava); Crafter lavaCrafter = newCrafter(lava, mom: earth, dad: fire); ctx.Crafters.Add(lavaCrafter); #endregion Lava NextId(); #region Steam Item steam = newItem("Steam"); ctx.Items.Add(steam); Crafter steamCrafter = newCrafter(steam, mom: fire, dad: water); ctx.Crafters.Add(steamCrafter); #endregion Steam #endregion Tier 2 NextTier(); #region Tier 3 #region Stone Item stone = newItem("Stone"); ctx.Items.Add(stone); Crafter stoneCrafter = newCrafter(stone, mom: air, dad: lava); ctx.Crafters.Add(stoneCrafter); #endregion Stone #endregion Tier 3 NextTier(); #region Tier 4 #region Metal Item metal = newItem("Metal"); ctx.Items.Add(metal); Crafter metalCrafter = newCrafter(metal, mom: fire, dad: stone); ctx.Crafters.Add(metalCrafter); #endregion Metal #endregion Tier 4 ctx.SaveChanges(); }