diff --git a/RPG.sln b/RPG.sln new file mode 100644 index 0000000..aa70abb --- /dev/null +++ b/RPG.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.29306.81 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RPG", "RPG\RPG.csproj", "{9DCB304A-3927-42E8-9D29-FB0820354E4E}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {9DCB304A-3927-42E8-9D29-FB0820354E4E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9DCB304A-3927-42E8-9D29-FB0820354E4E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9DCB304A-3927-42E8-9D29-FB0820354E4E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {9DCB304A-3927-42E8-9D29-FB0820354E4E}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {DA76A8FB-E2E4-4D4E-AD81-8576A401E586} + EndGlobalSection +EndGlobal diff --git a/RPG/Abilities.cs b/RPG/Abilities.cs new file mode 100644 index 0000000..6a1983b --- /dev/null +++ b/RPG/Abilities.cs @@ -0,0 +1,11 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace RPG +{ + public interface Abilities + { + void Ability(Player player); + } +} diff --git a/RPG/Archer.cs b/RPG/Archer.cs new file mode 100644 index 0000000..81400dc --- /dev/null +++ b/RPG/Archer.cs @@ -0,0 +1,24 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace RPG +{ + class Archer : Player + { + public Archer() + : this("Неизвестно") + { + } + public Archer(string name) + : this(name, null) + { + } + public Archer(string name, Player enemy) + : base(name, enemy) + { + Class = "Archer"; + UseAbility.Add(new ArcherAbility()); + } + } +} \ No newline at end of file diff --git a/RPG/ArchertAbility.cs b/RPG/ArchertAbility.cs new file mode 100644 index 0000000..5a05d57 --- /dev/null +++ b/RPG/ArchertAbility.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace RPG +{ + public class ArcherAbility : Abilities + { + public void Ability(Player player) + { + player.Enemy.Effects.Add("Fire arrows"); + Console.WriteLine("Player: {player.Class} use Fire arrows to {player.Enemy.Class}, {player.Enemy.Name}"); + } + } +} \ No newline at end of file diff --git a/RPG/Attack.cs b/RPG/Attack.cs new file mode 100644 index 0000000..cf21220 --- /dev/null +++ b/RPG/Attack.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace RPG +{ + public class Attack : Abilities + { + public void Ability(Player player) + { + player.Enemy.HP = player.Enemy.HP - player.Strong; + } + } +} diff --git a/RPG/Game.cs b/RPG/Game.cs new file mode 100644 index 0000000..8ac342d --- /dev/null +++ b/RPG/Game.cs @@ -0,0 +1,317 @@ +using System; +using System.Collections.Generic; +using System.Linq; + +namespace RPG +{ + public class Game + { + private static int team1Points = 0; + private static int team2Points = 0; + + static void Main(string[] args) + { + List team1 = new List(); + List team2 = new List(); + Console.WriteLine("Введи кол-во игроков"); + int numberOfPlayers = Convert.ToInt32(Console.ReadLine()); + string[] names = { "player1", "player2", "player3", "player4", "player5", "player6", "player7", "player8", "player9", "player10", "player11", "player12", "player13", "player14", "player15", "player16" }; + if ((numberOfPlayers % 2 != 0) || (numberOfPlayers <= 0) || (numberOfPlayers > 16)) + { + // Console.WriteLine("Вы ввели некоректное кол-во игроков"); + throw new ArgumentOutOfRangeException("incorect number of players"); + } + + Console.WriteLine(" "); + Console.WriteLine("Team1"); + for (int i = 0; i < numberOfPlayers / 2; i++) + { + Random rnd = new Random(); + int a = rnd.Next(0, 3); + if (a == 0) + { + team1.Add(new Knight(names[i])); + Console.WriteLine("Player number: {0}, named: {1}, take a character: Knight", i + 1, names[i]); + } + + if (a == 1) + { + team1.Add(new Archer()); + Console.WriteLine("Player number: {0}, named: {1}, take a character: Archer", i + 1, names[i]); + } + + if (a == 2) + { + team1.Add(new Mage()); + Console.WriteLine("Player number: {0}, named: {1}, take a character: Mage", i + 1, names[i]); + } + } + + Console.WriteLine("Team2"); + for (int i = numberOfPlayers / 2; i < numberOfPlayers; i++) + { + Random rnd = new Random(); + int a = rnd.Next(0, 3); + if (a == 0) + { + team2.Add(new Knight(names[i], team1[i - (numberOfPlayers / 2)])); + Console.WriteLine("Player number: {0}, named: {1}, take a character: Knight", i + 1, names[i]); + } + + if (a == 1) + { + team2.Add(new Archer(names[i], team1[i - (numberOfPlayers / 2)])); + Console.WriteLine("Player number: {0}, named: {1}, take a character: Archer", i + 1, names[i]); + } + + if (a == 2) + { + team2.Add(new Mage(names[i], team1[i - (numberOfPlayers / 2)])); + Console.WriteLine("Player number: {0}, named: {1}, take a character: Mage", i + 1, names[i]); + } + } + + Console.WriteLine(" "); + Console.WriteLine("Team1 vs Team2"); + + for (int i = 0; i < numberOfPlayers / 2; i++) + { + team1[i].Enemy = team2[i]; + + // Console.WriteLine(team1[i].Enemy); + Console.Write(team1[i]); + Console.Write(" vs "); + Console.WriteLine(team2[i]); + } + + Console.WriteLine(" "); + + for (int i = 0; i < numberOfPlayers / 2; i++) + { + Console.Write(team1[i]); + Console.Write(" vs "); + Console.WriteLine(team2[i]); + Fight(team1[i]); + } + + if (team1Points > team2Points) + { + Console.WriteLine("team1 win"); + } + + if (team2Points > team1Points) + { + Console.WriteLine("team2 win"); + } + + if (team2Points == team1Points) + { + Console.WriteLine("draw"); + } + } + + private static void Fight(Player player) + { + int turnNumber = 1; + int cooldownTeam1 = 0; + int cooldownTeam2 = 0; + Random rnd = new Random(); + Console.WriteLine(" "); + Console.WriteLine("{0} have {1}, his strong: {2}", player, player.HP, player.Strong); + Console.WriteLine("{0} have {1}, his strong: {2}", player.Enemy, player.Enemy.HP, player.Enemy.Strong); + while (player.HP > 0 && player.Enemy.HP > 0) + { + Console.WriteLine(" "); + Console.WriteLine("round {0}", turnNumber); + Console.WriteLine(" "); + + turnNumber++; + + Random b = new Random(); + var arr1 = new[] { 0, 1 }; + var rndMember = arr1[b.Next(arr1.Length)]; + + // int cooldown=0; + + // Console.WriteLine("rndMember={0}", rndMember); + if (player.Effects.Contains("Freezing")) + { + Console.WriteLine("{0} skip tyrn because of Freezing", player); + } + else + { + if (player.Effects.Contains("Fire arrows")) + { + player.HP = player.HP - 2; + if (player.HP > 0) + { + Console.WriteLine("{0} take 2 damage from Fire arrows, his HP {1}", player, player.HP); + } + + if (player.HP < 0) + { + team2Points = team2Points + 1; + player.HP = 0; + Console.WriteLine("{0} take 2 damage from Fire arrows, his HP {1}", player, player.HP); + Console.WriteLine("{0} have {1}", player.Enemy, player.Enemy.HP); + Console.WriteLine("{0}, win", player.Enemy); + Console.WriteLine(" "); + team2Points++; + break; + } + } + else + { + if ((rndMember != 0) && (cooldownTeam1 != 3)) + { + if (player.ToString() == "RPG.Knight") + { + Console.WriteLine("{0} use his ultimate Abilitiy and given damage equal 130% of his strong: {1}", player, player.Strong * 1.3); + player.Enemy.HP = player.Enemy.HP - (player.Strong * 1.3); + cooldownTeam1 = 3; + } + + if (player.ToString() == "RPG.Mage") + { + Console.WriteLine("{0} use his ultimate Abilitiy skipping turn on: {1}", player, player.Enemy); + player.Enemy.Effects.Add("Freezing"); + cooldownTeam1 = 3; + } + + if (player.ToString() == "RPG.Archer") + { + Console.WriteLine("{0} use his ultimate Abilitiy Fire arrows on: {1}", player, player.Enemy); + player.Enemy.Effects.Add("Fire arrows"); + cooldownTeam1 = 3; + } + } + else + { + player.Enemy.HP = player.Enemy.HP - player.Strong; + Console.WriteLine("{0} deal damage to {1} : {2}", player, player.Enemy, player.Strong); + + // if (cooldown == 0) { cooldown = 0; } + if ((cooldownTeam1 > 0) && (cooldownTeam1 < 4)) + { + cooldownTeam1--; + } + } + } + } + + // Console.WriteLine("{0} deal damage to {1} : {2}", player, player.Enemy, player.Strong); + if (player.Enemy.HP < 0) + { + team1Points = team1Points + 1; + player.Enemy.HP = 0; + Console.WriteLine("{0} have {1}", player, player.HP); + Console.WriteLine("{0} have {1}", player.Enemy, player.Enemy.HP); + Console.WriteLine("{0}, win", player); + Console.WriteLine(" "); + team1Points++; + break; + } + else + { + Console.WriteLine("{0} have {1}", player, player.HP); + Console.WriteLine("{0} have {1}", player.Enemy, player.Enemy.HP); + } + + Console.WriteLine(" "); + + /*if (player.Enemy.HP > 0) + { + Console.WriteLine("{0} deal damage to {1} : {2}", player.Enemy, player, player.Enemy.Strong); + // player.Enemy.Ability(); + player.HP = player.HP - player.Enemy.Strong; + }*/ + + if (player.Enemy.HP > 0) + { + if (player.Enemy.Effects.Contains("Freezing")) + { + Console.WriteLine("{0} skip tyrn because of Freezing", player.Enemy); + } + else + { + if (player.Enemy.Effects.Contains("Fire arrows")) + { + player.Enemy.HP = player.Enemy.HP - 2; + if (player.Enemy.HP > 0) + { + Console.WriteLine("{0} take 2 damage from Fire arrows, his HP {1}", player.Enemy, player.Enemy.HP); + } + + if (player.Enemy.HP < 0) + { + team1Points = team1Points + 1; + player.Enemy.HP = 0; + Console.WriteLine("{0} take 2 damage from Fire arrows, his HP {1}", player.Enemy, player.Enemy.HP); + Console.WriteLine("{0} have {1}", player, player.HP); + Console.WriteLine("{0}, win", player); + Console.WriteLine(" "); + team1Points++; + break; + } + } + else + { + if ((rndMember != 0) && (cooldownTeam2 != 3)) + { + if (player.ToString() == "RPG.Knight") + { + Console.WriteLine("{0} use his ultimate Abilitiy and given damage equal 130% of his strong: {1}", player.Enemy, player.Enemy.Strong * 1.3); + player.HP = player.HP - (player.Enemy.Strong * 1.3); + cooldownTeam2 = 3; + } + + if (player.ToString() == "RPG.Mage") + { + Console.WriteLine("{0} use his ultimate Abilitiy skipping turn on: {1}", player.Enemy, player); + player.Effects.Add("Freezing"); + cooldownTeam2 = 3; + } + + if (player.ToString() == "RPG.Archer") + { + Console.WriteLine("{0} use his ultimate Abilitiy Fire arrows on: {1}", player, player.Enemy); + player.Effects.Add("Fire arrows"); + cooldownTeam2 = 3; + } + } + else + { + player.HP = player.HP - player.Strong; + Console.WriteLine("{0} deal damage to {1} : {2}", player.Enemy, player, player.Enemy.Strong); + + // if (cooldown == 0) { cooldown = 0; } + if ((cooldownTeam2 > 0) && (cooldownTeam2 < 4)) + { + cooldownTeam2--; + } + } + } + } + } + + if (player.HP < 0) + { + player.HP = 0; + Console.WriteLine("{0} have {1}", player, player.HP); + Console.WriteLine("{0} have {1}", player.Enemy, player.Enemy.HP); + Console.WriteLine("{0}, win", player.Enemy); + Console.WriteLine(" "); + team2Points++; + break; + } + else + { + Console.WriteLine("{0} have {1}", player, player.HP); + Console.WriteLine("{0} have {1}", player.Enemy, player.Enemy.HP); + } + + Console.WriteLine(" "); + } + } + } +} diff --git a/RPG/Knight.cs b/RPG/Knight.cs new file mode 100644 index 0000000..fe0cd25 --- /dev/null +++ b/RPG/Knight.cs @@ -0,0 +1,24 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace RPG +{ + class Knight : Player + { + public Knight() + : this("Неизвестно") + { + } + public Knight(string name) + : this(name, null) + { + } + public Knight(string name, Player enemy) + : base(name, enemy) + { + Class = "Knight"; + UseAbility.Add(new KnightAbility()); + } + } +} diff --git a/RPG/KnightAbility.cs b/RPG/KnightAbility.cs new file mode 100644 index 0000000..9907fe6 --- /dev/null +++ b/RPG/KnightAbility.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace RPG +{ + public class KnightAbility : Abilities + { + public void Ability (Player player) + { + player.Enemy.HP = player.Enemy.HP - player.Strong* 1.3; + Console.WriteLine("Player: {player.Class} use retaliation strike and deal damage {plyer.Strong * 1.3} to {player.Enemy.Class}, {player.Enemy.Name}"); + } + } +} diff --git a/RPG/Mage.cs b/RPG/Mage.cs new file mode 100644 index 0000000..971b1db --- /dev/null +++ b/RPG/Mage.cs @@ -0,0 +1,24 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace RPG +{ + class Mage : Player + { + public Mage() + : this("Неизвестно") + { + } + public Mage(string name) + : this(name, null) + { + } + public Mage(string name, Player enemy) + : base(name, enemy) + { + Class = "Mage"; + UseAbility.Add(new MageAbility()); + } + } +} \ No newline at end of file diff --git a/RPG/MageAbility.cs b/RPG/MageAbility.cs new file mode 100644 index 0000000..0c78e61 --- /dev/null +++ b/RPG/MageAbility.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace RPG +{ + public class MageAbility : Abilities + { + public void Ability(Player player) + { + player.Enemy.Effects.Add("Freezing"); + Console.WriteLine("Player: {player.Class} use retaliation strike and deal damage {plyer.Strong * 1.3} to {player.Enemy.Class}, {player.Enemy.Name}"); + } + } +} diff --git a/RPG/Player.cs b/RPG/Player.cs new file mode 100644 index 0000000..558296e --- /dev/null +++ b/RPG/Player.cs @@ -0,0 +1,57 @@ +using System; +using System.Collections.Generic; +using System.Linq; + + +namespace RPG +{ + public abstract class Player + { + private static readonly Random rnd = new Random(); + public Player() + : this("Неизвестно") + { + } + public Player(string name) + : this(name, null) + { + } + public Player(string name, Player enemy) + { + Name = name; + Enemy = enemy; + UseAbility.Add(new Attack()); + } + public string Class { get; protected set; } + public string Name { get; set; } + public Player Enemy { get; set; } = null; + public double HP { get; set; } = rnd.Next(1, 100); + public int Strong { get; } = rnd.Next(1, 99); + public Abilities UsingAbility { get; set; } + + public List UseAbility = new List(); + public List Effects = new List(); + public void Ability() + { + if (!Effects.Contains("Freezing")) + { + if (!Effects.Contains("Fire arrows")) + { + UsingAbility.Ability(this); + } + else + { + HP = HP - 2; + Console.WriteLine("Player: {Name}, Class: {Class} take 2 damage from fire arrows"); + UsingAbility.Ability(this); + } + } + else + { + Console.WriteLine("Player: {Name}, Class{Class} skip pass"); + Effects.Remove("Freezing"); + } + } + + } +} diff --git a/RPG/RPG.csproj b/RPG/RPG.csproj new file mode 100644 index 0000000..23df604 --- /dev/null +++ b/RPG/RPG.csproj @@ -0,0 +1,8 @@ + + + + Exe + netcoreapp2.1 + + + diff --git a/soldatov.github.io/images/gerb.png b/soldatov.github.io/images/gerb.png new file mode 100644 index 0000000..44b0e8d Binary files /dev/null and b/soldatov.github.io/images/gerb.png differ diff --git a/soldatov.github.io/index.html b/soldatov.github.io/index.html new file mode 100644 index 0000000..689490b --- /dev/null +++ b/soldatov.github.io/index.html @@ -0,0 +1,36 @@ + + + + + + +
+ Солдатов Михаил +
+ +
+
+

Register

+

Please fill in this form to create an account.

+
+ + + + + + + + + +
+ +

By creating an account you agree to our Terms & Privacy.

+ +
+ + +
+ + \ No newline at end of file diff --git a/soldatov.github.io/style/Soldatov1.css b/soldatov.github.io/style/Soldatov1.css new file mode 100644 index 0000000..50e546d --- /dev/null +++ b/soldatov.github.io/style/Soldatov1.css @@ -0,0 +1,65 @@ +.text{ + margin-left: 18%; + border: 4px double red; + position: absolute; + max-width: 82%; +} +.ISUCT{ + margin-right: 82%; + border: 4px double black; +} + +* {box-sizing: border-box} + +/* Add padding to containers */ +.container { + padding: 16px; +} + +/* Full-width input fields */ +input[type=text], input[type=password] { + width: 100%; + padding: 15px; + margin: 5px 0 22px 0; + display: inline-block; + border: none; + background: #f1f1f1; +} + +input[type=text]:focus, input[type=password]:focus { + background-color: #ddd; + outline: none; +} + +/* Overwrite default styles of hr */ +hr { + border: 1px solid #f1f1f1; + margin-bottom: 25px; +} + +/* Set a style for the submit/register button */ +.registerbtn { + background-color: #4CAF50; + color: white; + padding: 16px 20px; + margin: 8px 0; + border: none; + cursor: pointer; + width: 100%; + opacity: 0.9; +} + +.registerbtn:hover { + opacity:1; +} + +/* Add a blue text color to links */ +a { + color: dodgerblue; +} + +/* Set a grey background color and center the text of the "sign in" section */ +.signin { + background-color: #f1f1f1; + text-align: center; +} \ No newline at end of file