From 05c552d57af967aa3a9415e973342bc7ee2966d2 Mon Sep 17 00:00:00 2001 From: MrColteR Date: Sat, 12 Dec 2020 18:27:28 +0300 Subject: [PATCH 1/6] Data --- .vscode/launch.json | 0 CourseApp/Country.cs | 2 +- CourseApp/Program.cs | 12 ++++++++++++ 3 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 .vscode/launch.json diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..e69de29 diff --git a/CourseApp/Country.cs b/CourseApp/Country.cs index 4629373..fbe6a57 100644 --- a/CourseApp/Country.cs +++ b/CourseApp/Country.cs @@ -10,7 +10,7 @@ public class Country public Country() { - Console.WriteLine($"Население, площадь и плоность не заданы"); + Console.WriteLine($"Население, площадь и плотность не заданы"); } public Country(int population, int area, double density) diff --git a/CourseApp/Program.cs b/CourseApp/Program.cs index be6f5e4..97e92fd 100644 --- a/CourseApp/Program.cs +++ b/CourseApp/Program.cs @@ -75,6 +75,18 @@ public static void Main(string[] args) country3.DensityInfo(); var union1 = new Union(5); union1.UnionInfo(); + Console.WriteLine(); + + DateTime zeroTime = new DateTime(1, 1, 1); + DateTime olddate = new DateTime(2020, 12, 9); + Console.WriteLine(olddate); + DateTime curdate = DateTime.Now.ToLocalTime(); + Console.WriteLine(curdate); + TimeSpan span = curdate - olddate; + int years = (zeroTime + span).Year - 1; + int months = (zeroTime + span).Month - 1; + int days = (zeroTime + span).Day - 1; + Console.WriteLine($"years = {years}, months = {months}, days = {days}"); Console.ReadKey(); } From a540ac149addc2e058fca60fee700767f2bc9831 Mon Sep 17 00:00:00 2001 From: MrColteR Date: Sat, 12 Dec 2020 18:53:54 +0300 Subject: [PATCH 2/6] Data and Test --- CourseApp.Tests/DataTests.cs | 35 +++++++++++++++++++++++++++++++++++ CourseApp/Program.cs | 21 ++++++++++++--------- 2 files changed, 47 insertions(+), 9 deletions(-) create mode 100644 CourseApp.Tests/DataTests.cs diff --git a/CourseApp.Tests/DataTests.cs b/CourseApp.Tests/DataTests.cs new file mode 100644 index 0000000..a4032ba --- /dev/null +++ b/CourseApp.Tests/DataTests.cs @@ -0,0 +1,35 @@ +using System; +using Xunit; + +namespace CourseApp.Tests +{ + public class DataTests + { + [Fact] + public void DataAfter() + { + DateTime a = new DateTime(20, 12, 12); + DateTime b = new DateTime(20, 12, 13); + var actualResult = Program.Date(a, b); + Assert.Equal("years = 0, months = 0, days = 1", actualResult); + } + + [Fact] + public void DataQuals() + { + DateTime a = new DateTime(20, 12, 12); + DateTime b = new DateTime(20, 12, 12); + var actualResult = Program.Date(a, b); + Assert.Equal("years = 0, months = 0, days = 0", actualResult); + } + + [Fact] + public void DataBefore() + { + DateTime a = new DateTime(20, 12, 12); + DateTime b = new DateTime(20, 12, 11); + var actualResult = Program.Date(a, b); + Assert.Equal("years = 0, months = 0, days = -1", actualResult); + } + } +} \ No newline at end of file diff --git a/CourseApp/Program.cs b/CourseApp/Program.cs index 97e92fd..bde3835 100644 --- a/CourseApp/Program.cs +++ b/CourseApp/Program.cs @@ -13,6 +13,16 @@ public static double Calc(double a, double b, double x) return y; } + public static string Date(DateTime olddate, DateTime zeroTime) + { + Console.WriteLine(olddate); + Console.WriteLine(zeroTime); + int years = zeroTime.Year - olddate.Year; + int months = zeroTime.Month - olddate.Month; + int days = zeroTime.Day - olddate.Day; + return $"years = {years}, months = {months}, days = {days}"; + } + public static (double x, double y)[] TaskA(double a, double b, double xn, double xk, double dx) { var res = new(double, double)[(int)Math.Ceiling((xk - xn) / dx) + 1]; @@ -77,16 +87,9 @@ public static void Main(string[] args) union1.UnionInfo(); Console.WriteLine(); - DateTime zeroTime = new DateTime(1, 1, 1); + DateTime zeroTime = DateTime.Today; DateTime olddate = new DateTime(2020, 12, 9); - Console.WriteLine(olddate); - DateTime curdate = DateTime.Now.ToLocalTime(); - Console.WriteLine(curdate); - TimeSpan span = curdate - olddate; - int years = (zeroTime + span).Year - 1; - int months = (zeroTime + span).Month - 1; - int days = (zeroTime + span).Day - 1; - Console.WriteLine($"years = {years}, months = {months}, days = {days}"); + Console.WriteLine(Date(olddate, zeroTime)); Console.ReadKey(); } From 6d33e72aa488c1a6de43d3e2c2bc35c9044fa64e Mon Sep 17 00:00:00 2001 From: MrColteR Date: Thu, 17 Dec 2020 14:36:48 +0300 Subject: [PATCH 3/6] data --- CourseApp.Tests/DataTests.cs | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/CourseApp.Tests/DataTests.cs b/CourseApp.Tests/DataTests.cs index a4032ba..e93a40d 100644 --- a/CourseApp.Tests/DataTests.cs +++ b/CourseApp.Tests/DataTests.cs @@ -8,17 +8,35 @@ public class DataTests [Fact] public void DataAfter() { - DateTime a = new DateTime(20, 12, 12); - DateTime b = new DateTime(20, 12, 13); + DateTime a = new DateTime(2020, 12, 12); + DateTime b = new DateTime(2020, 12, 13); var actualResult = Program.Date(a, b); Assert.Equal("years = 0, months = 0, days = 1", actualResult); } + [Fact] + public void Data1996() + { + DateTime a = new DateTime(1996, 12, 12); + DateTime b = new DateTime(2020, 12, 13); + var actualResult = Program.Date(a, b); + Assert.Equal("years = 24, months = 0, days = 1", actualResult); + } + + [Fact] + public void Data2010() + { + DateTime a = new DateTime(2010, 12, 12); + DateTime b = new DateTime(2020, 12, 13); + var actualResult = Program.Date(a, b); + Assert.Equal("years = 10, months = 0, days = 1", actualResult); + } + [Fact] public void DataQuals() { - DateTime a = new DateTime(20, 12, 12); - DateTime b = new DateTime(20, 12, 12); + DateTime a = new DateTime(2020, 12, 12); + DateTime b = new DateTime(2020, 12, 12); var actualResult = Program.Date(a, b); Assert.Equal("years = 0, months = 0, days = 0", actualResult); } @@ -26,8 +44,8 @@ public void DataQuals() [Fact] public void DataBefore() { - DateTime a = new DateTime(20, 12, 12); - DateTime b = new DateTime(20, 12, 11); + DateTime a = new DateTime(2020, 12, 12); + DateTime b = new DateTime(2020, 12, 11); var actualResult = Program.Date(a, b); Assert.Equal("years = 0, months = 0, days = -1", actualResult); } From 435a79e4b2620c121fbeb86c2dbc766ffb504368 Mon Sep 17 00:00:00 2001 From: MrColteR Date: Thu, 17 Dec 2020 15:57:14 +0300 Subject: [PATCH 4/6] Date and test --- CourseApp.Tests/DataTests.cs | 49 ++++++------------------------------ CourseApp/Program.cs | 27 ++++++++++++-------- 2 files changed, 25 insertions(+), 51 deletions(-) diff --git a/CourseApp.Tests/DataTests.cs b/CourseApp.Tests/DataTests.cs index e93a40d..23eeab0 100644 --- a/CourseApp.Tests/DataTests.cs +++ b/CourseApp.Tests/DataTests.cs @@ -5,49 +5,16 @@ namespace CourseApp.Tests { public class DataTests { - [Fact] - public void DataAfter() + [Theory] + [InlineData(2002, 10, 31, 2020, 12, 16, "Возраст: 18 лет(год), 1 месяцев(месяц), 16 дней(день)")] + [InlineData(2000, 12, 15, 2020, 12, 13, "Возраст: 19 лет(год), 11 месяцев(месяц), 29 дней(день)")] + [InlineData(2021, 12, 15, 2020, 12, 15, "Не верный возвраст")] + public void DateTest(int yearB, int monthB, int dayB, int yearT, int monthT, int dayT, string exp) { - DateTime a = new DateTime(2020, 12, 12); - DateTime b = new DateTime(2020, 12, 13); + DateTime a = new DateTime(yearB, monthB, dayB); + DateTime b = new DateTime(yearT, monthT, dayT); var actualResult = Program.Date(a, b); - Assert.Equal("years = 0, months = 0, days = 1", actualResult); - } - - [Fact] - public void Data1996() - { - DateTime a = new DateTime(1996, 12, 12); - DateTime b = new DateTime(2020, 12, 13); - var actualResult = Program.Date(a, b); - Assert.Equal("years = 24, months = 0, days = 1", actualResult); - } - - [Fact] - public void Data2010() - { - DateTime a = new DateTime(2010, 12, 12); - DateTime b = new DateTime(2020, 12, 13); - var actualResult = Program.Date(a, b); - Assert.Equal("years = 10, months = 0, days = 1", actualResult); - } - - [Fact] - public void DataQuals() - { - DateTime a = new DateTime(2020, 12, 12); - DateTime b = new DateTime(2020, 12, 12); - var actualResult = Program.Date(a, b); - Assert.Equal("years = 0, months = 0, days = 0", actualResult); - } - - [Fact] - public void DataBefore() - { - DateTime a = new DateTime(2020, 12, 12); - DateTime b = new DateTime(2020, 12, 11); - var actualResult = Program.Date(a, b); - Assert.Equal("years = 0, months = 0, days = -1", actualResult); + Assert.Equal(exp, actualResult); } } } \ No newline at end of file diff --git a/CourseApp/Program.cs b/CourseApp/Program.cs index bde3835..53d43a3 100644 --- a/CourseApp/Program.cs +++ b/CourseApp/Program.cs @@ -13,14 +13,20 @@ public static double Calc(double a, double b, double x) return y; } - public static string Date(DateTime olddate, DateTime zeroTime) + public static string Date(DateTime birthdaydate, DateTime todaydate) { - Console.WriteLine(olddate); - Console.WriteLine(zeroTime); - int years = zeroTime.Year - olddate.Year; - int months = zeroTime.Month - olddate.Month; - int days = zeroTime.Day - olddate.Day; - return $"years = {years}, months = {months}, days = {days}"; + var today = todaydate.Ticks; + var birthday = birthdaydate.Ticks; + if (birthday <= today) + { + var a = today - birthday; + DateTime one = new DateTime(a); + return $"Возраст: {one.Year - 1} лет(год), {one.Month - 1} месяцев(месяц), {one.Day - 1} дней(день)"; + } + else + { + return $"Не верный возвраст"; + } } public static (double x, double y)[] TaskA(double a, double b, double xn, double xk, double dx) @@ -87,9 +93,10 @@ public static void Main(string[] args) union1.UnionInfo(); Console.WriteLine(); - DateTime zeroTime = DateTime.Today; - DateTime olddate = new DateTime(2020, 12, 9); - Console.WriteLine(Date(olddate, zeroTime)); + DateTime birthday = new DateTime(2000, 12, 15); + DateTime today = DateTime.Now; + var age = Program.Date(birthday, today); + Console.WriteLine(age); Console.ReadKey(); } From 2a7aacf5f16901ad3b0743e5c19915afa9cf7d6e Mon Sep 17 00:00:00 2001 From: MrColteR Date: Mon, 28 Dec 2020 19:04:52 +0300 Subject: [PATCH 5/6] RPG --- CourseApp.Tests/DataTests.cs | 20 ---- CourseApp.Tests/DemoTest.cs | 95 ------------------ CourseApp.Tests/TestClass1.cs | 32 ------ CourseApp/Archer.cs | 23 +++++ CourseApp/Knight.cs | 23 +++++ CourseApp/Magician.cs | 23 +++++ CourseApp/Player.cs | 167 ++++++++++++++++++++++++++++++ CourseApp/Program.cs | 184 ++++++++++++++++++---------------- 8 files changed, 333 insertions(+), 234 deletions(-) delete mode 100644 CourseApp.Tests/DataTests.cs delete mode 100644 CourseApp.Tests/DemoTest.cs delete mode 100644 CourseApp.Tests/TestClass1.cs create mode 100644 CourseApp/Archer.cs create mode 100644 CourseApp/Knight.cs create mode 100644 CourseApp/Magician.cs create mode 100644 CourseApp/Player.cs diff --git a/CourseApp.Tests/DataTests.cs b/CourseApp.Tests/DataTests.cs deleted file mode 100644 index 23eeab0..0000000 --- a/CourseApp.Tests/DataTests.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System; -using Xunit; - -namespace CourseApp.Tests -{ - public class DataTests - { - [Theory] - [InlineData(2002, 10, 31, 2020, 12, 16, "Возраст: 18 лет(год), 1 месяцев(месяц), 16 дней(день)")] - [InlineData(2000, 12, 15, 2020, 12, 13, "Возраст: 19 лет(год), 11 месяцев(месяц), 29 дней(день)")] - [InlineData(2021, 12, 15, 2020, 12, 15, "Не верный возвраст")] - public void DateTest(int yearB, int monthB, int dayB, int yearT, int monthT, int dayT, string exp) - { - DateTime a = new DateTime(yearB, monthB, dayB); - DateTime b = new DateTime(yearT, monthT, dayT); - var actualResult = Program.Date(a, b); - Assert.Equal(exp, actualResult); - } - } -} \ No newline at end of file diff --git a/CourseApp.Tests/DemoTest.cs b/CourseApp.Tests/DemoTest.cs deleted file mode 100644 index 14357d6..0000000 --- a/CourseApp.Tests/DemoTest.cs +++ /dev/null @@ -1,95 +0,0 @@ -using System; -using Xunit; - -namespace CourseApp.Tests -{ - public class DemoTest - { - [Theory] - [InlineData(0, 0, 0, double.NaN)] - - public void TestCalcAllZero(double a, double b, double x, double exp) - { - var actualResult = Program.Calc(a, b, x); - Assert.Equal(exp, actualResult); - } - - [Fact] - public void Test1() - { - Assert.True(true); - } - - [Fact] - public void NumenatorEqualZero() - { - var actualResult = Program.Calc(1, 2, 2); - Assert.Equal(double.NaN, actualResult); - } - - [Fact] - public void DenominatorEqualZero() - { - var actualResult = Program.Calc(1, 1, 0); - Assert.Equal(double.NaN, actualResult); - } - - [Fact] - public void LogEqualZero() - { - var actualResult = Program.Calc(1, 0, 0); - Assert.Equal(double.NaN, actualResult); - } - - [Fact] - public void ArrayLenght() - { - var actualResult = Program.TaskA(2, 1.1, 0.08, 1.08, 0.2); - Assert.Equal(6, actualResult.Length); - } - - [Fact] - public void Array() - { - var actualResult = Program.TaskA(2, 1.1, 1, 6, 1); - Assert.Equal(6, actualResult.Length); - double[] expX = { 1, 2, 3, 4, 5, 6 }; - for (int i = 0; i <= 5; i++) - { - var (x, y) = actualResult[i]; - Assert.Equal(expX[i], x, 1); - } - } - - [Fact] - public void ArrayOfThreeElements() - { - double[] xTest = { 1, 2, 3 }; - var actualResult = Program.TaskB(2, 1.1, xTest); - Assert.Equal(3, actualResult.Length); - } - - [Fact] - public void ArrayOfZeroElements() - { - double[] xTest = { }; - var actualResult = Program.TaskB(2, 1, xTest); - var a = actualResult.Length; - Assert.Equal(0, a); - } - - [Fact] - public void RootOfFive() - { - var actualResult = Program.CubeRoot(-32); - Assert.Equal(-2, actualResult); - } - - [Fact] - public void RootOfFive2() - { - var actualResult = Program.CubeRoot(32); - Assert.Equal(2, actualResult); - } - } -} \ No newline at end of file diff --git a/CourseApp.Tests/TestClass1.cs b/CourseApp.Tests/TestClass1.cs deleted file mode 100644 index de138d0..0000000 --- a/CourseApp.Tests/TestClass1.cs +++ /dev/null @@ -1,32 +0,0 @@ -using System; -using Xunit; - -namespace CourseApp.Tests -{ - public class TestClass1 - { - [Fact] - public void ZeroOfPopulation() - { - Country country2 = new Country(0, 40, 185); - var actualResult = country2.Population; - Assert.Equal(0, actualResult); - } - - [Fact] - public void ZeroOfArea() - { - Country country2 = new Country(13860, 0, 185); - var actualResult = country2.Area; - Assert.Equal(0, actualResult); - } - - [Fact] - public void ZeroOfDensity() - { - Country country2 = new Country(13860, 40, 0); - var actualResult = country2.Density; - Assert.Equal(0, actualResult); - } - } -} \ No newline at end of file diff --git a/CourseApp/Archer.cs b/CourseApp/Archer.cs new file mode 100644 index 0000000..657ab67 --- /dev/null +++ b/CourseApp/Archer.cs @@ -0,0 +1,23 @@ +using System; + +namespace CourseApp +{ + public class Archer : Player + { + public Archer(string name) + : base(name) + { + } + + public override int DealDamage(bool useUlt) + { + if (useUlt) + { + Console.WriteLine($"{Name} ультанул, огненные стрелы"); + return 0; + } + + return Power; + } + } +} \ No newline at end of file diff --git a/CourseApp/Knight.cs b/CourseApp/Knight.cs new file mode 100644 index 0000000..b80d245 --- /dev/null +++ b/CourseApp/Knight.cs @@ -0,0 +1,23 @@ +using System; + +namespace CourseApp +{ + public class Knight : Player + { + public Knight(string name) + : base(name) + { + } + + public override int DealDamage(bool useUlt) + { + if (useUlt) + { + Console.WriteLine($"{Name} ультанул, +30% к урону"); + return Convert.ToInt32(Math.Floor(Power * 1.3)); + } + + return Power; + } + } +} \ No newline at end of file diff --git a/CourseApp/Magician.cs b/CourseApp/Magician.cs new file mode 100644 index 0000000..2e75ef9 --- /dev/null +++ b/CourseApp/Magician.cs @@ -0,0 +1,23 @@ +using System; + +namespace CourseApp +{ + public class Magician : Player + { + public Magician(string name) + : base(name) + { + } + + public override int DealDamage(bool useUlt) + { + if (useUlt) + { + Console.WriteLine($"{Name} ультанул, пропуск хода"); + return 0; + } + + return Power; + } + } +} \ No newline at end of file diff --git a/CourseApp/Player.cs b/CourseApp/Player.cs new file mode 100644 index 0000000..ece1960 --- /dev/null +++ b/CourseApp/Player.cs @@ -0,0 +1,167 @@ +using System; + +namespace CourseApp +{ + public class Player + { + private int health; + private int power; + private string name; + private bool isOnFire = false; + private bool frozen; + private int defaultHealth; + private int defaultPower; + + public Player(string name) + { + this.Name = name; + Random random = new Random(); + this.defaultHealth = random.Next(40, 70); + this.Health = this.defaultHealth; + this.defaultPower = random.Next(10, 20); + this.Power = this.defaultPower; + } + + public int Health + { + get + { + return health; + } + + set + { + if (value < 0) + { + throw new InvalidOperationException("Не верное значение"); + } + else + { + health = value; + } + } + } + + public int Power + { + get + { + return power; + } + + set + { + if (value < 0) + { + throw new InvalidOperationException("Не верное значение"); + } + else + { + power = value; + } + } + } + + public string Name + { + get + { + return name; + } + + set + { + if (value == " ") + { + Console.WriteLine("Нет значения"); + } + else + { + name = value; + } + } + } + + public virtual bool Frozen + { + get + { + return frozen; + } + + set + { + value = false; + } + } + + public virtual int DealDamage(bool useUlt) + { + return Power; + } + + public virtual int GetDamage(int damage, string type) + { + if (Health - damage < 0) + { + Health = 0; + this.isOnFire = false; + } + else + { + Health -= damage; + } + + if (this.isOnFire && type == "Archer") + { + return Health - 2; + } + + if (damage == 0 && type == "Archer") + { + this.isOnFire = true; + } + + if (this.frozen = true && type == "Magician") + { + this.frozen = false; + } + + if (damage == 0 && type == "Magician") + { + this.frozen = true; + } + + return Health; + } + + public virtual bool UseUlt() + { + Random a = new Random(); + int powerA = a.Next(1, 4); + return powerA == 2; + } + + public int GetHealth() + { + return Health; + } + + public int GetPower() + { + return Power; + } + + public string GetName() + { + return Name; + } + + public void RestoreStats() + { + this.Health = this.defaultHealth; + this.Power = this.defaultPower; + this.isOnFire = false; + } + } +} \ No newline at end of file diff --git a/CourseApp/Program.cs b/CourseApp/Program.cs index 53d43a3..d60caea 100644 --- a/CourseApp/Program.cs +++ b/CourseApp/Program.cs @@ -1,115 +1,125 @@ using System; +using System.Threading; +using System.Collections.Generic; namespace CourseApp { public class Program { - public static double Calc(double a, double b, double x) - { - var numerator = Math.Log(Math.Abs(Math.Pow(b, 2) - Math.Pow(x, 2)), a); - var denominator = Math.Abs(Math.Pow(x, 2) - Math.Pow(a, 2)); - CubeRoot(denominator); - var y = numerator / denominator; - return y; - } - - public static string Date(DateTime birthdaydate, DateTime todaydate) + public static void Main(string[] args) { - var today = todaydate.Ticks; - var birthday = birthdaydate.Ticks; - if (birthday <= today) - { - var a = today - birthday; - DateTime one = new DateTime(a); - return $"Возраст: {one.Year - 1} лет(год), {one.Month - 1} месяцев(месяц), {one.Day - 1} дней(день)"; - } - else + Console.Write("Введите кол-во героев: "); + int number = Convert.ToInt16(Console.ReadLine()); + Console.WriteLine(); + List type = new List(); + List excess = new List(); + List hero = new List(number); + string[] nameArray = new string[20] { "Player_1", "Player_2", "Player_3", "Player_4", "Player_5", "Player_6", "Player_7", "Player_8", "Player_9", "Player_10", "Player_11", "Player_12", "Player_13", "Player_14", "Player_15", "Player_16", "Player_17", "Player_18", "Player_19", "Player_20" }; + if (number % 2.0 != 0) { - return $"Не верный возвраст"; + throw new InvalidOperationException("Число героев нечетное"); } - } - public static (double x, double y)[] TaskA(double a, double b, double xn, double xk, double dx) - { - var res = new(double, double)[(int)Math.Ceiling((xk - xn) / dx) + 1]; - int i = 0; - for (var x = xn; x <= xk; x += dx) + for (int i = 0; i < number; i++) { - var y = Calc(a, b, x); - res[i] = (x, y); - i++; + Random random = new Random(); + string name = nameArray[random.Next(0, 19)]; + type.Add(GetHeroType()); + switch (type[i]) + { + case "Knight": + hero.Add(new Knight(name)); + break; + case "Archer": + hero.Add(new Archer(name)); + break; + case "Magician": + hero.Add(new Magician(name)); + break; + } } - return res; - } - - public static (double x, double y)[] TaskB(double a, double b, double[] xItems) - { - var res = new(double, double)[xItems.Length]; - int i = 0; - foreach (var x in xItems) + while (number > 1) { - var y = Calc(a, b, x); - res[i] = (x, y); - i++; - } + bool isExcessHero = false; + if (hero.Count % 2.0 != 0) + { + excess.Add(hero[hero.Count - 1]); + hero.RemoveAt(hero.Count - 1); + isExcessHero = true; + } - return res; - } + for (int i = 0; i < hero.Count; i = i + 2) + { + Console.WriteLine($"Игрок: {hero[i].GetName()} класса {type[i]} cила = {hero[i].GetPower()}, ХР = {hero[i].GetHealth()} против Игрока: {hero[i + 1].GetName()} класса {type[i + 1]}, сила = {hero[i + 1].GetPower()} , ХР = {hero[i + 1].GetHealth()}"); + Console.ReadKey(); + int step = 0; + while (hero[i].GetHealth() > 0 && hero[i + 1].GetHealth() > 0) + { + Console.WriteLine($"{hero[i + step].GetName()} наносит урон игроку {hero[i + 1 - step].GetName()}"); + if (!hero[i + step].Frozen) + { + hero[i + 1 - step].GetDamage(hero[i + step].DealDamage(hero[i + step].UseUlt()), type[i + step]); + Thread.Sleep(100); + } - public static void Main(string[] args) - { - const double a = 2.0; - const double b = 1.1; - Console.WriteLine($"--------- TASK A --------------"); - var taskA = TaskA(a, b, 0.08, 1.08, 0.2); - foreach (var item in taskA) - { - var(x, y) = item; - Console.WriteLine($"x={x}, y={y}"); - } + Console.WriteLine($"Игрок {hero[i + 1 - step].GetName()}, XP = {hero[i + 1 - step].GetHealth()} "); + step = (step + 1) % 2; + Thread.Sleep(100); + } - Console.WriteLine($"--------- TASK B --------------"); - double[] xItems = { 0.1, 0.3, 0.4, 0.45, 0.65 }; - var taskB = TaskB(a, b, xItems); - foreach (var item in taskB) - { - var(x, y) = item; - Console.WriteLine($"x={x}, y={y}"); - } + if (hero[i].GetHealth() <= 0) + { + Console.WriteLine($"Игрок {hero[i + 1].GetName()} победил"); + Console.WriteLine(); + Console.ReadKey(); + } - Console.WriteLine("Hello World!"); + if (hero[i + 1].GetHealth() <= 0) + { + Console.WriteLine($"Игрок {hero[i].GetName()} победил"); + Console.WriteLine(); + Console.ReadKey(); + } + } - var country1 = new Country(); - country1.AllInfo(); - var country2 = new Country(7420, 40, 185.5); - country2.AllInfo(); - country2.Population = 0; - var country3 = new Country(13450, 100, 134.5); - country3.PopulationInfo(); - country3.AreaInfo(); - country3.DensityInfo(); - var union1 = new Union(5); - union1.UnionInfo(); - Console.WriteLine(); + if (isExcessHero) + { + hero.Add(excess[0]); + excess.RemoveAt(0); + isExcessHero = false; + } - DateTime birthday = new DateTime(2000, 12, 15); - DateTime today = DateTime.Now; - var age = Program.Date(birthday, today); - Console.WriteLine(age); + int j = 0; + while (j < hero.Count) + { + if (hero[j].GetHealth() <= 0) + { + hero.RemoveAt(j); + } + else + { + hero[j].RestoreStats(); + j++; + } + } - Console.ReadKey(); + number = Convert.ToInt16(number / 2.0); + } } - public static double CubeRoot(double x) + private static string GetHeroType() { - if (x < 0) - { - return -Math.Pow(-x, 1d / 5d); - } - else + Random type = new Random(); + int typeHero = type.Next(1, 3); + switch (typeHero) { - return Math.Pow(x, 1d / 5d); + case 1: + return "Knight"; + case 2: + return "Archer"; + default: + return "Magician"; } } } From cdc96741cbe99fb9f3b8c1788af96196aed79b87 Mon Sep 17 00:00:00 2001 From: MrColteR Date: Thu, 25 Feb 2021 17:59:37 +0300 Subject: [PATCH 6/6] 11 --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index b389250..b9d8f94 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,3 @@ # Tprogramming_42_2020 -## Boleslav_Piguta \ No newline at end of file +## Boleslav_Piguta +>https://github.com/MrColteR/sitee \ No newline at end of file