public void Bolezn(ref Resyrs tmp) { int die = rand.Next(tmp.hobit - (tmp.medic * 5)); tmp.hobit -= die; Console.WriteLine("\n\n\n\t\t Осторожно!!!! В городе вспалахнула епидемия гриппа и умирают люди!!!! Примите какие-то меры!!!"); Console.ReadLine(); }
public void Print(int cursor, Resyrs tmp) { Console.Clear(); Console.WriteLine("\t\t Приветствуем в игре \"ЧТО ПОПАЛО\""); tmp.Show(); if (cursor >= 5) { cursor = (cursor % 5); } else if (cursor < 0) { cursor = (cursor % 5) + 5; } for (int i = 0; i < 5; i++) { if (cursor == i) { Console.WriteLine("=> " + menu[i]); } else { Console.WriteLine(" " + menu[i]); } } }
public void Golod(ref Resyrs tmp) { tmp.point -= 25; if (tmp.point < 100) { Bolezn(ref tmp); Console.WriteLine("\n\n\n\t\t Осторожно!!!! В городе голодомор!!!! Примите какие-то меры!!!"); Console.ReadLine(); } }
public void Year(ref Resyrs tmp) { int p = -1; Math.Pow(p, rand.Next(10)); tmp.hobit -= (p * rand.Next(Convert.ToInt32(tmp.hobit * 0.1))); tmp.point += tmp.hobit * 2; Console.WriteLine(" В связи с окончением года произошли демографические изменения в жителях"); Console.ReadLine(); }
public void Debosh(ref Resyrs tmp) { if (tmp.hobit / 20 > tmp.security) { tmp.hobit -= rand.Next(tmp.hobit - 20 * tmp.security); Console.WriteLine("\n\n\n\t\t Осторожно!!!! В городе массовые безпорядки!!!! Примите какие-то меры!!!"); Console.ReadLine(); } else Console.WriteLine("\n\n\n\t\t Было остановлено дебоши"); }
public void GetDamba(ref Resyrs tmp) { if (tmp.point > 1000) { tmp.point -= 1000; tmp.damba += 100; } else { Console.WriteLine(" \n\n\n\t\t У тебя не достаточно денег"); } }
public void TurnHome(ref Resyrs tmp) { if (tmp.point > 100) { tmp.point -= 100; tmp.home += 1; tmp.hobit += 20; } else { Console.WriteLine(" У тебя не достаточно денег"); } }
public void GetMedic(ref Resyrs tmp) { if (tmp.point > 100 && tmp.hobit > 20) { tmp.point -= 100; tmp.medic += 20; tmp.hobit -= 20; } else { Console.WriteLine(" \n\n\n\t\t У тебя не достаточно людей"); } }
public void TurnScurity(ref Resyrs tmp) { if (tmp.point > 100 && tmp.hobit > 20) { tmp.point -= 100; tmp.security += 20; tmp.hobit -= 20; } else { Console.WriteLine(" \n\n\n\t\tУ тебя не достаточно людей"); } }
public void Debosh(ref Resyrs tmp) { if (tmp.hobit / 20 > tmp.security) { tmp.hobit -= rand.Next(tmp.hobit - 20 * tmp.security); Console.WriteLine("\n\n\n\t\t Осторожно!!!! В городе массовые безпорядки!!!! Примите какие-то меры!!!"); Console.ReadLine(); } else { Console.WriteLine("\n\n\n\t\t Было остановлено дебоши"); } }
public void Napast(ref Resyrs tmp) { if (tmp.point > 1000 && tmp.security > 700) { tmp.point += rand.Next(500, 10000) - 1000; tmp.security -= rand.Next(400); tmp.medic -= rand.Next(150); } else { Console.WriteLine(" \n\n\n\t\t У тебя не достаточно или денег или воинов"); Console.ReadLine(); } }
public void Procent(ref Resyrs tmp) { switch (rand.Next(0, 5)) { case 0: { if (rand.Next(10) <= 5) { Navod(ref tmp); } } break; case 1: { if (rand.Next(50) <= 10) { Ataka(ref tmp); } } break; case 2: { if (rand.Next(50) <= 10) { Bolezn(ref tmp); } } break; case 3: { if (rand.Next(50) <= 10) { Golod(ref tmp); } } break; case 4: { if (rand.Next(100) <= 10) { Debosh(ref tmp); } } break; } }
public void Navod(ref Resyrs tmp) { if(tmp.hobit-tmp.damba>0) { int dom = rand.Next(tmp.home / rand.Next(tmp.home)); tmp.home -= dom; tmp.hobit -= dom * 20; Console.WriteLine("\n\n\n\t\t Осторожно!!!! Произошло наводнение!!!! Примите какие-то меры!!!"); Console.ReadLine(); } else Console.WriteLine("\n\n\n\t\t Произошло наводнение!!!! Но дамба спасла"); Console.ReadLine(); }
public void Ataka(ref Resyrs tmp) { int vrag = rand.Next(600); if ((tmp.security -= vrag) < 0) { tmp.hobit += tmp.security; tmp.home += (tmp.security / 20); tmp.security = 0; Console.WriteLine("\n\n\n\t\t Осторожно!!!! Произошла атака монстров!!!! Примите какие-то меры!!!"); Console.ReadLine(); } else Console.WriteLine("\n\n\n\t\t Была отбита атака монстров!!!! "); Console.ReadLine(); }
public void Navod(ref Resyrs tmp) { if (tmp.hobit - tmp.damba > 0) { int dom = rand.Next(tmp.home / rand.Next(tmp.home)); tmp.home -= dom; tmp.hobit -= dom * 20; Console.WriteLine("\n\n\n\t\t Осторожно!!!! Произошло наводнение!!!! Примите какие-то меры!!!"); Console.ReadLine(); } else { Console.WriteLine("\n\n\n\t\t Произошло наводнение!!!! Но дамба спасла"); } Console.ReadLine(); }
public void Ataka(ref Resyrs tmp) { int vrag = rand.Next(600); if ((tmp.security -= vrag) < 0) { tmp.hobit += tmp.security; tmp.home += (tmp.security / 20); tmp.security = 0; Console.WriteLine("\n\n\n\t\t Осторожно!!!! Произошла атака монстров!!!! Примите какие-то меры!!!"); Console.ReadLine(); } else { Console.WriteLine("\n\n\n\t\t Была отбита атака монстров!!!! "); } Console.ReadLine(); }
public void Procent(ref Resyrs tmp) { switch(rand.Next(0,5)) { case 0: { if(rand.Next(10)<=5) Navod(ref tmp); } break; case 1: { if (rand.Next(50) <= 10) Ataka(ref tmp); } break; case 2: { if (rand.Next(50) <= 10) Bolezn(ref tmp); } break; case 3: { if (rand.Next(50) <= 10) Golod(ref tmp); } break; case 4: { if (rand.Next(100) <= 10) Debosh(ref tmp); } break; } }
public void Year(ref Resyrs tmp) { int p = -1; Math.Pow(p, rand.Next(10)); tmp.hobit -= (p * rand.Next(Convert.ToInt32(tmp.hobit * 0.1))); tmp.point+=tmp.hobit*2; Console.WriteLine(" В связи с окончением года произошли демографические изменения в жителях"); Console.ReadLine(); }
static void Main(string[] args) { ConsoleKeyInfo klava; Resyrs tmp = new Resyrs(); Action move = new Action(); Events doit = new Events(); int cursor = 0; move.Print(cursor, tmp); do { klava = Console.ReadKey(true); if (klava.Key == ConsoleKey.UpArrow) { cursor--; move.Print(cursor, tmp); } if (klava.Key == ConsoleKey.DownArrow) { cursor++; move.Print(cursor, tmp); } if (klava.Key == ConsoleKey.Enter) { doit.Procent(ref tmp); tmp.day++; if (cursor >= 5) { cursor = (cursor % 5); } else if (cursor < 0) { cursor = (cursor % 5) + 5; } switch (cursor) { case 0: move.TurnScurity(ref tmp); break; case 1: move.GetDamba(ref tmp); break; case 2: move.TurnHome(ref tmp); break; case 3: move.Napast(ref tmp); break; case 4: move.GetMedic(ref tmp); break; } if (tmp.day >= 12) { tmp.day = 0; doit.Year(ref tmp); } move.Print(cursor, tmp); Console.WriteLine("\n\n Твой ход"); } }while(klava.Key != ConsoleKey.Escape); //Console.ReadLine(); // if (klava.Key==ConsoleKey.UpArrow) //{ //Console.WriteLine("upppppppp"); //} }
static void Main(string[] args) { ConsoleKeyInfo klava; Resyrs tmp = new Resyrs(); Action move=new Action(); Events doit = new Events(); int cursor=0; move.Print(cursor, tmp); do { klava = Console.ReadKey(true); if(klava.Key==ConsoleKey.UpArrow) { cursor--; move.Print(cursor,tmp); } if(klava.Key==ConsoleKey.DownArrow) { cursor++; move.Print(cursor, tmp); } if (klava.Key == ConsoleKey.Enter) { doit.Procent(ref tmp); tmp.day++; if (cursor >= 5) cursor = (cursor % 5); else if (cursor < 0) cursor = (cursor % 5) + 5; switch (cursor) { case 0: move.TurnScurity(ref tmp); break; case 1: move.GetDamba(ref tmp); break; case 2: move.TurnHome(ref tmp); break; case 3: move.Napast(ref tmp); break; case 4: move.GetMedic(ref tmp); break; } if(tmp.day>=12) { tmp.day=0; doit.Year(ref tmp); } move.Print(cursor, tmp); Console.WriteLine("\n\n Твой ход"); } }while(klava.Key!=ConsoleKey.Escape); //Console.ReadLine(); // if (klava.Key==ConsoleKey.UpArrow) //{ //Console.WriteLine("upppppppp"); //} }