diff --git a/CourseApp.Tests/YearsOldTest.cs b/CourseApp.Tests/YearsOldTest.cs new file mode 100644 index 0000000..34410a9 --- /dev/null +++ b/CourseApp.Tests/YearsOldTest.cs @@ -0,0 +1,59 @@ +using System; +using Xunit; + +namespace CourseApp.Tests +{ + public class YearsOldTest + { + [Fact] + public void TestAgeYesterday() + { + string st = $"Вам 10 года(лет), 0 месяца(месяцев) и 1 дня(дней)"; + Assert.Equal(st, YearsOld.Age(new DateTime(2009, 12, 20), new DateTime(2019, 12, 21))); + } + + [Fact] + public void TestAgeToday() + { + string st = $"Вам 8 года(лет), 0 месяца(месяцев) и 0 дня(дней)"; + Assert.Equal(st, YearsOld.Age(new DateTime(2011, 12, 21), new DateTime(2019, 12, 21))); + } + + [Fact] + public void TestAgeTommorow() + { + string st = $"Вам 10 года(лет), 0 месяца(месяцев) и 0 дня(дней)"; + Assert.Equal(st, YearsOld.Age(new DateTime(2009, 12, 21), new DateTime(2019, 12, 21))); + } + + [Fact] + public void TestAge() + { + string st = $"Вам 13 года(лет), 11 месяца(месяцев) и 22 дня(дней)"; + Assert.Equal(st, YearsOld.Age(new DateTime(2000, 11, 20), new DateTime(2014, 11, 11))); + } + + [Fact] + public void BirthdayAboveToday() + { + try + { + string years = YearsOld.Age(new DateTime(2019, 12, 21), new DateTime(2048, 8, 16)); + Assert.Equal(0, DateTime.Compare(DateTime.Now, DateTime.Parse(years))); + } + catch (Exception) + { + Console.WriteLine("Birthday > Today"); + } + } + + [Fact] + public void TestYears() + { + if (YearsOld.Age(DateTime.Now) == YearsOld.Age(new DateTime(2019, 12, 25))) + { + Assert.True(true); + } + } + } +} \ No newline at end of file diff --git a/CourseApp/YearsOld.cs b/CourseApp/YearsOld.cs new file mode 100644 index 0000000..8241796 --- /dev/null +++ b/CourseApp/YearsOld.cs @@ -0,0 +1,34 @@ +using System; +using System.Collections.Generic; + +namespace CourseApp +{ + public class YearsOld + { + public static string Age(DateTime date) + { + return Age(date, DateTime.Now); + } + + public static string Age(DateTime fromDate, DateTime toDate) + { + if (fromDate.Ticks < toDate.Ticks) + { + DateTime dateCompare = new DateTime(toDate.Ticks - fromDate.Ticks); + return $"Вам {dateCompare.Year - 1} года(лет), {dateCompare.Month - 1} месяца(месяцев) и {dateCompare.Day - 1} дня(дней)"; + } + + throw new Exception(); + } + + public static DateTime YourAge() + { + int years = int.Parse(Console.ReadLine()); + int months = int.Parse(Console.ReadLine()); + int days = int.Parse(Console.ReadLine()); + string result = Age(new DateTime(years, months, days), DateTime.Now); + DateTime resultTime = DateTime.Parse(result); + return resultTime; + } + } +} \ No newline at end of file diff --git a/RPG/Archer.cs b/RPG/Archer.cs new file mode 100644 index 0000000..ca62a62 --- /dev/null +++ b/RPG/Archer.cs @@ -0,0 +1,24 @@ +using System; + +namespace RPG +{ + public class Archer : Hero + { + Random random = new Random(); + + public Archer() + : base() + { + heroClass = "Archer"; + skillName = "Fire arrows"; + } + + public override int Skill() + { + bufName = "Fire arrows"; + buf = true; + bufDamage = 5; + return 0; + } + } +} diff --git a/RPG/Fight.cs b/RPG/Fight.cs new file mode 100644 index 0000000..f4d197b --- /dev/null +++ b/RPG/Fight.cs @@ -0,0 +1,171 @@ +using System; +using System.Collections.Generic; + +namespace RPG +{ + public struct Fight + { + public Hero hero1; + public Hero hero2; + } + + public class Fights + { + + static Logger logger = new Logger(); + static Random rnd = new Random(); + static List fight = new List(); + static int rounds = 0; + + static void CreateFights() + { + while (Game.heroes.Count > 1) + { + int k = rnd.Next(0, Game.heroes.Count - 1); + Fight fights = new Fight(); + fights.hero1 = Game.heroes[k]; + Game.heroes.RemoveAt(k); + + k = rnd.Next(0, Game.heroes.Count); + fights.hero2 = Game.heroes[k]; + Game.heroes.RemoveAt(k); + + fight.Add(fights); + } + } + + static void Atack(Hero attacking, Hero attacked) + { + int damage; + + if(attacking.buf) + { + damage = attacking.Atack(); + logger.Atack(attacking, attacked, damage); + attacked.GetDamage(damage + attacking.bufDamage); + } + else + { + damage = attacking.Atack(); + logger.Atack(attacking, attacked, damage); + attacked.GetDamage(damage); + } + } + + static void Skill(Hero attacking, Hero attacked) + { + int damage; + + if(attacking.buf || attacking.sleepTime > 0) + { + Atack(attacking, attacked); + } + else + { + damage = attacking.Skill(); + logger.Skill(attacking, attacked, attacking.skillName, damage); + attacked.GetDamage(damage); + } + } + + static void Win(Hero winner, Hero loser) + { + winner.sleepTime = 0; + winner.buf = false; + Game.heroes.Add(winner); + logger.Win(winner); + logger.Death(loser); + } + + public static void Fight() + { + CreateFights(); + int i = rnd.Next(0, fight.Count); + Hero hero1 = fight[i].hero1; + Hero hero2 = fight[i].hero2; + fight.RemoveAt(i); + + int turn = rnd.Next(0, 1); + rounds++; + Console.WriteLine("_____________________________________________________________________________"); + Console.WriteLine($"Round №{rounds}\n"); + while (true) + { + + if(turn == 0) + { + if(hero2.sleepTime == 0) + { + if(rnd.Next(0,10) > 6) + { + Skill(hero1, hero2); + } + else + { + Atack(hero1, hero2); + } + } + else + { + logger.Sleep(hero1); + hero2.sleepTime--; + } + + if(hero2.Health <= 0) + { + Win(hero1, hero2); + if(fight.Count == 0) + { + break; + } + + i = rnd.Next(0, fight.Count); + hero1 = fight[i].hero1; + hero2 = fight[i].hero2; + fight.RemoveAt(i); + } + + + + turn = 1; + } + else + { + if(hero1.sleepTime == 0) + { + if(rnd.Next(0,10) > 6) + { + Skill(hero2, hero1); + } + else + { + Atack(hero2, hero1); + } + } + else + { + logger.Sleep(hero2); + hero1.sleepTime--; + } + + if(hero1.Health <= 0) + { + Win(hero2, hero1); + if(fight.Count == 0) + { + break; + } + i = rnd.Next(0, fight.Count); + hero1 = fight[i].hero1; + hero2 = fight[i].hero2; + fight.RemoveAt(i); + } + + + + turn = 0; + } + } + } + } +} diff --git a/RPG/Game.cs b/RPG/Game.cs new file mode 100644 index 0000000..256db38 --- /dev/null +++ b/RPG/Game.cs @@ -0,0 +1,49 @@ +using System; +using System.Collections.Generic; + +namespace RPG +{ + public class Game + { + public static List heroes = new List(); + Random rnd = new Random(); + + public void Start(int numOfHeroes) + { + CreateHeroes(numOfHeroes); + while(heroes.Count != 1) + { + Fights.Fight(); + } + + Console.WriteLine("_____________________________________________________________________________"); + Console.ForegroundColor = ConsoleColor.Green; + Console.WriteLine($"\nWinner - {heroes[0].Name} ({heroes[0].heroClass})"); + Console.ResetColor(); + } + + public void CreateHeroes(int numOfHeroes) + { + + while(numOfHeroes > 0) + { + switch(rnd.Next(0,3)) + { + case 0: + heroes.Add(new Archer()); + break; + case 1: + heroes.Add(new Knight()); + break; + case 2: + heroes.Add(new Mage()); + break; + default: + heroes.Add(new Mage()); + break; + } + numOfHeroes--; + } + } + } +} diff --git a/RPG/Hero.cs b/RPG/Hero.cs new file mode 100644 index 0000000..87fbcf8 --- /dev/null +++ b/RPG/Hero.cs @@ -0,0 +1,85 @@ +using System; + +namespace RPG +{ + public class Hero + { + Random random = new Random(); + public string heroClass; + public string skillName; + public bool buf = false; + public string bufName; + public int bufDamage; + public int sleepTime = 0; + public int maxHealth; + + public Hero() + { + Health = random.Next(100,200); + maxHealth = Health; + Name = Names[random.Next(0,40)]; + Strength = random.Next(10,50); + } + + public static string[] Names = new string[40]{ + "Ylfat", + "Gayaz", + "Mergen", + "Salih", + "Hayrat", + "Salavat", + "Hattab", + "Fidel", + "Mirgalim", + "Zamam", + "Zayd", + "Habib", + "Azamat", + "Artyr", + "Afzal", + "Amir", + "Danis", + "Bayan", + "Alim", + "Karim", + "Rizvan", + "Shafik", + "Rasim", + "Rafail", + "Ramil", + "Mars", + "Naki", + "Hotaka", + "Kisho", + "Yuu", + "Nikki", + "Katsuo", + "Kichiro", + "Marise", + "Rinji", + "Montaro", + "Mamoru", + "Ryuu", + "Takumi", + "Rafu", + }; + public string Name { get; protected set; } + public int Strength { get; protected set; } + public int Health { get; set; } + + public virtual int Skill() + { + return 0; + } + + public int Atack() + { + return random.Next(1, Strength); + } + + public void GetDamage(int damage) + { + Health -= damage; + } + } +} diff --git a/RPG/Knight.cs b/RPG/Knight.cs new file mode 100644 index 0000000..b3bccb7 --- /dev/null +++ b/RPG/Knight.cs @@ -0,0 +1,21 @@ +using System; + +namespace RPG +{ + public class Knight : Hero + { + Random random = new Random(); + + public Knight() + : base() + { + heroClass = "Knight"; + skillName = "Retaliation strike"; + } + + public override int Skill() + { + return (int)Math.Floor(Strength * 1.5); + } + } +} diff --git a/RPG/Logger.cs b/RPG/Logger.cs new file mode 100644 index 0000000..26886a0 --- /dev/null +++ b/RPG/Logger.cs @@ -0,0 +1,65 @@ +using System; + +namespace RPG +{ + class Logger + { + public void Atack(Hero hero1, Hero hero2, int damage) + { + Console.Write($"{hero1.Name} ({hero1.heroClass}) hit {hero2.Name} ({hero2.heroClass}) and deals {damage} damage"); + + if(hero1.buf) + { + Console.WriteLine($" Additional damage of {hero1.bufDamage} units due to the amplification \"{hero1.bufName}\"."); + } + else + { + Console.WriteLine(); + } + } + + public void Skill(Hero hero1, Hero hero2, string skillName, int damage) + { + if(hero1.sleepTime > 0 && damage == 0) + { + Console.WriteLine($"{hero1.Name} ({hero1.heroClass}) used skill \"{skillName}\" and stuns {hero2.Name} ({hero2.heroClass}) for {hero1.sleepTime} turns."); + } + else if(hero1.buf && damage == 0) + { + Console.WriteLine($"{hero1.Name} ({hero1.heroClass}) used buf \"{skillName}\""); + } + else + { + Console.Write($"{hero1.Name} ({hero1.heroClass}) used skill \"{skillName}\" and deals {hero2.Name} ({hero2.heroClass}) {damage} damage."); + + if(hero1.buf) + { + Console.WriteLine($" Additional damage of {hero1.bufDamage} units due to the amplification \"{hero1.bufName}\"."); + } + else + { + Console.WriteLine(); + } + } + } + + public void Sleep(Hero hero) + { + Console.WriteLine($"{hero.Name} ({hero.heroClass}) stunned and skips turn."); + } + + public void Win(Hero hero) + { + Console.ForegroundColor = ConsoleColor.Green; + Console.WriteLine($"{hero.Name} ({hero.heroClass}) won!"); + Console.ResetColor(); + } + + public void Death(Hero hero) + { + Console.ForegroundColor = ConsoleColor.Red; + Console.WriteLine($"{hero.Name} ({hero.heroClass}) is dead.\n"); + Console.ResetColor(); + } + } +} diff --git a/RPG/Mage.cs b/RPG/Mage.cs new file mode 100644 index 0000000..ef2f9e5 --- /dev/null +++ b/RPG/Mage.cs @@ -0,0 +1,23 @@ +using System; + +namespace RPG +{ + public class Mage : Hero + { + Random random = new Random(); + + public Mage() + : base() + { + heroClass = "Mage"; + skillName = "Fascination"; + } + + public override int Skill() + { + + sleepTime = 2; + return 0; + } + } +} diff --git a/RPG/Program.cs b/RPG/Program.cs new file mode 100644 index 0000000..98c0d79 --- /dev/null +++ b/RPG/Program.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; + +namespace RPG +{ + class Program + { + static void Main(string[] args) + { + Game game = new Game(); + Console.Write("Enter the number of heroes: "); + + int numOfHeroes = Int32.Parse(Console.ReadLine()); + + if(numOfHeroes % 2 != 0) + { + numOfHeroes += 1; + } + + game.Start(numOfHeroes); + + Console.ReadKey(); + } + } +} diff --git a/RPG/RPG.csproj b/RPG/RPG.csproj new file mode 100644 index 0000000..958d2f1 --- /dev/null +++ b/RPG/RPG.csproj @@ -0,0 +1,8 @@ + + + + Exe + netcoreapp3.0 + + + diff --git a/SnowPanther37.github.io/css/style.css b/SnowPanther37.github.io/css/style.css new file mode 100644 index 0000000..652d33a --- /dev/null +++ b/SnowPanther37.github.io/css/style.css @@ -0,0 +1,77 @@ +body { + background-image: url("https://images.wallpapersden.com/image/download/3d-abstract-colorful-surface-line_64504_1440x900.jpg"); +} +#block-body { + width: 1035px; + margin: 5px auto; + height: 160px; +} +header { + width: 1100px; + height: 100px; + background-color: #7A0000; +} +#block-content { + width: 1035px; + height: auto; + min-height: 50px; +} +.logo { + width: 200px; + float: left; + height: 80px; +} +.logo a { + display: block; + margin-left: 15px; + margin-top: 10px; + font-family: "Exo2-Bold", sans-serif; + font-size: 28px; + color: #b2aeb2; + text-decoration: none; + cursor: pointer; +} +.use { + color: #00FFFF; + +} +.web { + color: #00FFFF; +} +.logo p { + margin-left: 20px; + margin-top: 2px; + margin-bottom: 5px; + font-family: "Exo2-Medium", sans-serif; + font-size: 13px; + color: white; +} +.top-menu { + width: 685px; + height: 80px; + float: left; +} +.top-menu ul li { + list-style: none; + float: left; + text-align: center; +} +.top-menu ul li a { + display: block; + width: 171px; + text-decoration: none; + font-family: "Exo2-Medium", sans-serif; + font-size: 17px; + color: white; + height: 55px; + padding-top: 25px; + cursor: pointer; +} +.top-menu ul li a:hover { + transition: all 0.5s ease; + -webkit-transition: all 0.5s ease; + -o-transition: all 0.5s ease; + -ms-transition:all 0.5s ease; + -moz-transition:all 0.5s ease; + background: #bf2233; +} \ No newline at end of file diff --git a/SnowPanther37.github.io/img/DICH.png b/SnowPanther37.github.io/img/DICH.png new file mode 100644 index 0000000..304a245 Binary files /dev/null and b/SnowPanther37.github.io/img/DICH.png differ diff --git a/SnowPanther37.github.io/img/animepv.gif b/SnowPanther37.github.io/img/animepv.gif new file mode 100644 index 0000000..f7172f5 Binary files /dev/null and b/SnowPanther37.github.io/img/animepv.gif differ diff --git a/SnowPanther37.github.io/img/animetv.gif b/SnowPanther37.github.io/img/animetv.gif new file mode 100644 index 0000000..fe2b90e Binary files /dev/null and b/SnowPanther37.github.io/img/animetv.gif differ diff --git a/SnowPanther37.github.io/img/devyatka.gif b/SnowPanther37.github.io/img/devyatka.gif new file mode 100644 index 0000000..7d334e3 Binary files /dev/null and b/SnowPanther37.github.io/img/devyatka.gif differ diff --git a/SnowPanther37.github.io/img/himteh.jpg b/SnowPanther37.github.io/img/himteh.jpg new file mode 100644 index 0000000..35781b2 Binary files /dev/null and b/SnowPanther37.github.io/img/himteh.jpg differ diff --git a/SnowPanther37.github.io/index.html b/SnowPanther37.github.io/index.html new file mode 100644 index 0000000..1fbe071 --- /dev/null +++ b/SnowPanther37.github.io/index.html @@ -0,0 +1,63 @@ + + + + + + Сайт Химтеховца + + + + + + + + + +
+
+ + +
+
+
+
+
+
+

ISUCT - Ивановский Государственный Химико-Технологический Университет

+

Учусь на втором курсе...

+
+ +
+
+
+

Обо мне

+

Сомов Евгений, 2/42

+

Стараюсь учиться (вроде даже удачно)

+ +
+
+

Контакты

+

creepershowmem@gmail.com

+

Номер не дам, так как все ровно постоянно сбрасываю

+ +
+
+
+
+
+ + + \ No newline at end of file