diff --git a/CourseApp.Tests/Auto_Tests.cs b/CourseApp.Tests/AutoTests.cs similarity index 98% rename from CourseApp.Tests/Auto_Tests.cs rename to CourseApp.Tests/AutoTests.cs index 5491c3e..93fcaf7 100644 --- a/CourseApp.Tests/Auto_Tests.cs +++ b/CourseApp.Tests/AutoTests.cs @@ -3,7 +3,7 @@ using AutoApp; using Xunit; - public class Auto_Tests + public class AutoTests { [Fact] public void Test1() diff --git a/CourseApp.Tests/RPGsagaTest.cs b/CourseApp.Tests/RPGsagaTest.cs new file mode 100644 index 0000000..dd2323e --- /dev/null +++ b/CourseApp.Tests/RPGsagaTest.cs @@ -0,0 +1,82 @@ +namespace RPGsagaApp.Tests +{ + using RPGsagaApp; + using Xunit; + + public class RPGsagaTest + { + [Fact] + public void Test1() + { + Assert.True(true); + } + + [Fact] + public void TestConstructor() + { + var hero1 = new Knight(50, 20, "(Рыцарь) Ричард", "Удар возмездя"); + Assert.Equal(50, hero1.Health); + Assert.Equal(20, hero1.Power); + Assert.Equal("(Рыцарь) Ричард", hero1.Name); + + var hero2 = new Archer(50, 20, "(Лучник) Леголас", "Огненные стрелы"); + Assert.Equal(50, hero2.Health); + Assert.Equal(20, hero2.Power); + Assert.Equal("(Лучник) Леголас", hero2.Name); + + while ((hero1.Health > 0) && (hero2.Health > 0)) + { + hero1.Action(); + hero2.Damage(); + if (hero2.Health <= 0) + { + break; + } + + hero2.Action(); + hero1.Damage(); + if (hero1.Health <= 0) + { + break; + } + } + } + + [Fact] + public void TestConstructor2() + { + var hero1 = new Knight(50, 20, "(Рыцарь) Зигфрид", "Удар возмездя"); + Assert.Equal(50, hero1.Health); + Assert.Equal(20, hero1.Power); + Assert.Equal("(Рыцарь) Зигфрид", hero1.Name); + + var hero2 = new Magician(50, 20, "(Маг) Дамблдор", "Заворожение"); + Assert.Equal(50, hero2.Health); + Assert.Equal(20, hero2.Power); + Assert.Equal("(Маг) Дамблдор", hero2.Name); + + while ((hero1.Health > 0) && (hero2.Health > 0)) + { + hero2.Action(); + hero1.Damage(); + if (hero1.Health <= 0) + { + break; + } + + hero1.Action(); + hero2.Damage(); + if (hero2.Health <= 0) + { + break; + } + } + } + + [Fact] + + public void TestConstructorFinal() + { + } + } +} diff --git a/CourseApp/Program.cs b/CourseApp/Program.cs index 6a4b38d..62d77bf 100644 --- a/CourseApp/Program.cs +++ b/CourseApp/Program.cs @@ -1,6 +1,8 @@ -namespace AutoApp +namespace CourseApp { using System; + using AutoApp; + using RPGsagaApp; public class Program { @@ -23,13 +25,51 @@ public static void Main(string[] args) Automobile minibus = new Minibus("Маршрутка"); Automobile bus = new Bus("Автобус"); Automobile trolleybus = new Trolleybus("Троллейбус"); - Console.WriteLine("--------------------------"); + Console.WriteLine(" "); Console.WriteLine(minibus.Display()); minibus.Move(); Console.WriteLine(bus.Display()); bus.Move(); Console.WriteLine(trolleybus.Display()); trolleybus.Move(); + Console.WriteLine("-------------------------------------------------"); + + Game saga = new Game(); + saga.Print(); + + Game rpg = new Game(100, 35, "(Рыцарь) Артур", "Удар возмездия"); + int characterHealth = rpg.Health; + int characterPower = rpg.Power; + string characterName = rpg.Name; + string characterAbility = rpg.Ability; + Console.WriteLine($"Здоровье: {characterHealth} Сила: {characterPower} Имя: {characterName} Способность: {characterAbility}"); + + rpg.Health = 50; + rpg.Power = 20; + rpg.Name = "(Рыцарь) Ричард"; + rpg.Ability = "Удар возмездия"; + Console.WriteLine(rpg.Print()); + + Hero knight1 = new Knight(50, 20, "(Рыцарь) Ричард", "Удар возмездия"); + Hero knight2 = new Knight(50, 20, "(Рыцарь) Зигфрид", "Удар возмездия"); + Hero archer = new Archer(50, 20, "(Лучник) Леголас", "Огненные стрелы"); + Hero magician = new Magician(50, 20, "(Маг) Дамблдор", "Заворожение"); + Console.WriteLine(" "); + + Game fight1 = new Game(); + Console.WriteLine(fight1.EnterFight(1)); + Console.WriteLine(fight1.Advertisement(knight1, archer)); + fight1.Fight(knight1, archer); + + Game fight2 = new Game(); + fight2.EnterFight(1); + fight2.Advertisement(knight2, magician); + fight2.Fight(knight2, magician); + + Game fightFinal = new Game(); + fightFinal.EnterFight(2); + fightFinal.Advertisement(knight1, knight2); + fightFinal.Fight(knight1, knight2); } } -} +} \ No newline at end of file diff --git a/CourseApp/RPGsaga/Archer.cs b/CourseApp/RPGsaga/Archer.cs new file mode 100644 index 0000000..939a3b0 --- /dev/null +++ b/CourseApp/RPGsaga/Archer.cs @@ -0,0 +1,19 @@ +namespace RPGsagaApp +{ + using System; + + public class Archer : Hero + { + public Archer(int health, int power, string name, string ability) + : base(health, power, name, ability) + { + } + + public override string AbilityDisplay() + { + Console.WriteLine($"Лучник {Name} использует {Ability}"); + Health = Health - 2; + return $" {Name} периодически получает урон {Health} от способности {Ability}"; + } + } +} diff --git a/CourseApp/RPGsaga/Game.cs b/CourseApp/RPGsaga/Game.cs new file mode 100644 index 0000000..665cfb2 --- /dev/null +++ b/CourseApp/RPGsaga/Game.cs @@ -0,0 +1,63 @@ +namespace RPGsagaApp +{ + using System; + + public class Game + { + public Game() + { + } + + public Game(int health, int power, string name, string ability) + { + Health = health; + Power = power; + Name = name; + Ability = ability; + } + + public int Health { get; set; } + + public int Power { get; set; } + + public string Name { get; set; } + + public string Ability { get; set; } + + public string Print() + { + return $"Здоровье: {Health} Сила: {Power} Имя: {Name} Способность: {Ability}"; + } + + public string EnterFight(int n_kon) + { + return $"Кон. {n_kon};"; + } + + public string Advertisement(Hero hero1, Hero hero2) + { + return $"{hero1.Name} vs {hero2.Name}"; + } + + public Hero Fight(Hero hero1, Hero hero2) + { + hero1.Action(); + hero2.Damage(); + if (hero2.Health <= 0) + { + Console.WriteLine($"{hero2.Name} погибает"); + return hero1; + } + + hero2.Action(); + hero1.Damage(); + if (hero1.Health <= 0) + { + Console.WriteLine($"{hero1.Name} погибает"); + return hero2; + } + + return hero1; + } + } +} diff --git a/CourseApp/RPGsaga/Hero.cs b/CourseApp/RPGsaga/Hero.cs new file mode 100644 index 0000000..892e7d4 --- /dev/null +++ b/CourseApp/RPGsaga/Hero.cs @@ -0,0 +1,39 @@ +namespace RPGsagaApp +{ + using System; + + public abstract class Hero + { + private int defaultHealth; + + public Hero(int health, int power, string name, string ability) + { + Health = health; + defaultHealth = Health; + Power = power; + Name = name; + Ability = ability; + } + + public int Health { get; set; } + + public int Power { get; set; } + + public string Name { get; set; } + + public string Ability { get; set; } + + public abstract string AbilityDisplay(); + + public void Action() + { + Console.WriteLine($"{Name} наносит урон {Power} противнику"); + } + + public void Damage() + { + Health = Health - Power; + Console.WriteLine($"{Name} получил урон {Power} и теряет {Health} единицы жизни"); + } + } +} diff --git a/CourseApp/RPGsaga/Knight.cs b/CourseApp/RPGsaga/Knight.cs new file mode 100644 index 0000000..2c2e2ad --- /dev/null +++ b/CourseApp/RPGsaga/Knight.cs @@ -0,0 +1,16 @@ +namespace RPGsagaApp +{ + public class Knight : Hero + { + public Knight(int health, int power, string name, string ability) + : base(health, power, name, ability) + { + } + + public override string AbilityDisplay() + { + Power = Power + 30; + return $"Рыцарь {Name} использует {Ability} и наносит урон {Power} противнику"; + } + } +} diff --git a/CourseApp/RPGsaga/Logger.cs b/CourseApp/RPGsaga/Logger.cs new file mode 100644 index 0000000..7d58aee --- /dev/null +++ b/CourseApp/RPGsaga/Logger.cs @@ -0,0 +1,10 @@ +namespace RPGsagaApp +{ + public class Logger + { + public string GameOver(Hero winner) + { + return $"Победителем становится {winner}!"; + } + } +} \ No newline at end of file diff --git a/CourseApp/RPGsaga/Magician.cs b/CourseApp/RPGsaga/Magician.cs new file mode 100644 index 0000000..739736c --- /dev/null +++ b/CourseApp/RPGsaga/Magician.cs @@ -0,0 +1,18 @@ +namespace RPGsagaApp +{ + using System; + + public class Magician : Hero + { + public Magician(int health, int power, string name, string ability) + : base(health, power, name, ability) + { + } + + public override string AbilityDisplay() + { + Console.WriteLine($"Маг {Name} использует {Ability}"); + return $"{Name} пропускает ход из-за способности {Ability}"; + } + } +} diff --git a/index.html b/index.html new file mode 100644 index 0000000..9050cac --- /dev/null +++ b/index.html @@ -0,0 +1,73 @@ + + + + + Web сайт + + + + + + + + + +
+
+

Жуленков Никита Ильич

+ +

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

+

Далее »

+
+
+
+
+
+

Учебное заведение\(Работа)

+

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

+

Далее »

+
+
+

Увлечения

+

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

+

Далее »

+
+
+

Личная жизнь

+

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

+

Далее »

+
+
+
+ +
+ + + + + +