public IActionResult Index() { Dachi dachi = GetDachi(); ViewBag.Dachi = dachi; List <string> messages = new List <string>(); if (TempData["original_fullness"] != null) { int temp = dachi.Fullness - (int)TempData["original_fullness"]; if (temp > 0) { messages.Add("Your Dojodachi gained " + temp + " fullness!"); } else { messages.Add("Your Dojodachi lost " + (-1 * temp) + " fullness!"); } } if (TempData["original_happiness"] != null) { int temp = dachi.Happiness - (int)TempData["original_happiness"]; if (temp > 0) { messages.Add("Your Dojodachi gained " + temp + " happiness!"); } else { messages.Add("Your Dojodachi lost " + (-1 * temp) + " happiness!"); } } if (TempData["original_meals"] != null) { int temp = dachi.Meals - (int)TempData["original_meals"]; if (temp > 0) { messages.Add("Your Dojodachi gained " + temp + " meals!"); } else { messages.Add("Your Dojodachi lost " + (-1 * temp) + " meals!"); } } if (TempData["original_energy"] != null) { int temp = dachi.Energy - (int)TempData["original_energy"]; if (temp > 0) { messages.Add("Your Dojodachi gained " + temp + " energy!"); } else { messages.Add("Your Dojodachi lost " + (-1 * temp) + " energy!"); } } ViewBag.Reset = false; if (dachi.HasWon()) { messages.Add("Your Dojodachi has Won!"); ViewBag.Reset = true; } else if (!dachi.Alive) { messages.Add("Your Dojodachi has Lost!"); ViewBag.Reset = true; } ViewBag.Messages = messages; return(View()); }