diff --git a/RPG.sln b/RPG.sln new file mode 100644 index 0000000..01cbade --- /dev/null +++ b/RPG.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.28010.2026 +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..cb5b79c --- /dev/null +++ b/RPG/Game.cs @@ -0,0 +1,684 @@ +using System; +using System.Collections.Generic; +using System.Linq; + +namespace RPG +{ + public enum CharacterClass + { + Knight, + Archer, + Mage + } + + public enum CharacterAbilities + { + Freezing, //заморозка + Fire_arrows, //огненные стрелы + Сritical_damage //критический урон + } + public class Game + { + private static int EnemyNumber; + private static double T1HP = 0; + private static double T2HP = 0; + private static double TeamAlive1(int numberOfPlayers, List team1) + { + T1HP = 0; + for (int i = 0; i < numberOfPlayers / 2; i++) + { + //Console.WriteLine("team1: {0} , his HP{1}", team1[i], team1[i].HP); + T1HP = T1HP + team1[i].HP; + } + return T1HP; + } + private static double TeamAlive2 (int numberOfPlayers, List team2) + { + T2HP = 0; + for (int i = numberOfPlayers / 2; i < numberOfPlayers; i++) + { + //double T2HP; + /*Console.WriteLine(T2HP); + Console.WriteLine(team2[i-6]); + Console.WriteLine(team2[i-6].HP);*/ + T2HP = T2HP + team2[i- numberOfPlayers / 2].HP; + } + return T2HP; + } + + private static void PickPlayer(int numberOfPlayers, List team1, List team2) + { + + 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)) + { + throw new ArgumentOutOfRangeException("incorect number of players"); + } + + Console.WriteLine(" "); + Console.WriteLine("Team1"); + for (int i = 0; i < numberOfPlayers / 2; i++) + { + CharacterClass yourPlayerClass = (CharacterClass)(new Random()).Next(0, 3); + switch (yourPlayerClass) + { + case CharacterClass.Knight: + team1.Add(new Knight(names[i])); + Console.WriteLine("Player number: {0}, named: {1}, take a character: Knight", i + 1, names[i]); + Console.WriteLine("HIS HP: {0} HIS STRONG {1}", team1[i].HP, team1[i].Strong); + break; + case CharacterClass.Archer: + team1.Add(new Archer(names[i])); + Console.WriteLine("Player number: {0}, named: {1}, take a character: Archer", i + 1, names[i]); + Console.WriteLine("HIS HP: {0} HIS STRONG {1}", team1[i].HP, team1[i].Strong); + break; + case CharacterClass.Mage: + team1.Add(new Mage(names[i])); + Console.WriteLine("Player number: {0}, named: {1}, take a character: Mage", i + 1, names[i]); + Console.WriteLine("HIS HP: {0} HIS STRONG {1}", team1[i].HP, team1[i].Strong); + break; + } + } + + Console.WriteLine("Team2"); + for (int i = numberOfPlayers / 2; i < numberOfPlayers; i++) + { + CharacterClass yourPlayerClass = (CharacterClass)(new Random()).Next(0, 3); + switch (yourPlayerClass) + { + case CharacterClass.Knight: + team2.Add(new Knight(names[i])); + Console.WriteLine("Player number: {0}, named: {1}, take a character: Knight", i + 1, names[i]); + Console.WriteLine("HIS HP: {0}, HIS STRONG {1}", team2[i- numberOfPlayers/2].HP, team2[i- numberOfPlayers / 2].Strong); + break; + case CharacterClass.Archer: + team2.Add(new Archer(names[i])); + Console.WriteLine("Player number: {0}, named: {1}, take a character: Archer", i + 1, names[i]); + Console.WriteLine("HIS HP: {0} HIS STRONG {1}", team2[i - numberOfPlayers / 2].HP, team2[i- numberOfPlayers / 2].Strong); + break; + case CharacterClass.Mage: + team2.Add(new Mage(names[i])); + Console.WriteLine("Player number: {0}, named: {1}, take a character: Mage", i + 1, names[i]); + Console.WriteLine("HIS HP: {0} HIS STRONG {1}", team2[i - numberOfPlayers / 2].HP, team2[i- numberOfPlayers / 2].Strong); + break; + } + } + + Console.WriteLine(" "); + Console.WriteLine("Team1 vs Team2"); + + for (int i = 0; i < numberOfPlayers / 2; i++) + { + Console.Write(team1[i]); + Console.Write(" vs "); + Console.WriteLine(team2[i]); + } + + } + static void Main(string[] args) + { + int turn_number=1; + List team1 = new List(); + List team2 = new List(); + Console.WriteLine("Введи кол-во игроков"); + int numberOfPlayers = Convert.ToInt32(Console.ReadLine()); + int[] cooldown = new int[numberOfPlayers]; + PickPlayer(numberOfPlayers, team1, team2); + + Console.WriteLine(" "); + for (int i = 0; i < numberOfPlayers; i++) + { + cooldown[i] = 0; + } + + while ((TeamAlive1(numberOfPlayers, team1) > 0) && (TeamAlive2(numberOfPlayers, team2)>0)) + { + Console.WriteLine("turn number: {0}", turn_number); + Console.WriteLine(" "); + Console.WriteLine("{0}+{1}+{2}+{3}+{4}+{5}= ", team1[0].HP, team1[1].HP, team1[2].HP, team1[3].HP, team1[4].HP, team1[5].HP); + Console.Write("HPTeam1: {0}", TeamAlive1(numberOfPlayers, team1)); + Console.WriteLine(" "); + Console.WriteLine("HPTeam2: {0}", TeamAlive2(numberOfPlayers, team2)); + Console.WriteLine(" "); + for (int i = 0; i < numberOfPlayers / 2; i++) + { + Random rnd = new Random(); + int enemyNumber = rnd.Next(0, numberOfPlayers/2); + if (team1[i].HP > 0) + { + Fight(team1[i], enemyNumber, cooldown[i], 1, team1, team2); + } + else + { + Console.WriteLine("You are dead"); + } + } + for (int i = numberOfPlayers / 2 + 1 ; i < numberOfPlayers; i++) + { + Random rnd = new Random(); + int enemyNumber = rnd.Next(0, numberOfPlayers / 2); + if (team2[i- numberOfPlayers / 2].HP > 0) + { + Fight(team2[i- numberOfPlayers / 2], enemyNumber, cooldown[i], 2, team1, team2); + } + } + Console.WriteLine(" "); + Console.WriteLine("Оставшееся здоровье у героев после раунда {0}", turn_number); + for (int i = 0; i < numberOfPlayers / 2; i++) + { + Console.WriteLine("player number {0} named {1}, have {2} ", i, team1[i], team1[i].HP); + } + for (int i = numberOfPlayers / 2; i < numberOfPlayers; i++) + { + Console.WriteLine("player number {0} named {1}, have {2} ", i, team2[i - numberOfPlayers / 2], team2[i - numberOfPlayers / 2].HP); + } + turn_number++; + } + + Console.WriteLine(" "); + Console.WriteLine("Оставшееся здоровье у героев"); + + for (int i = 0; i < numberOfPlayers/2; i++) + { + Console.WriteLine("player number {0} named {1}, have {2} ",i,team1[i], team1[i].HP); + } + + for (int i = numberOfPlayers / 2; i < numberOfPlayers; i++) + { + Console.WriteLine("player number {0} named {1}, have {2} ", i, team2[i- numberOfPlayers / 2], team2[i- numberOfPlayers / 2].HP); + } + + if (TeamAlive1(numberOfPlayers, team1) == 0) + { + Console.WriteLine("Team2 win"); + } + else + { + Console.WriteLine("Team1 win"); + } + + } + + private static void Fight(Player player, int enemyNumber, int kd, int TeamTurn, List team1, List team2) + { + Random rnd = new Random(); + Random b = new Random(); + var arr1 = new[] { 0, 1 }; + var rndMember = arr1[b.Next(arr1.Length)]; + int turnNumber = 1; + int TT = TeamTurn; + + if (TT == 1) + { + player.Enemy = team2[enemyNumber]; + } + else + { + player.Enemy = team1[enemyNumber]; + } + 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) + { + 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(" "); + //goto link1; + return ; + } + } + else + { + if ((rndMember != 0) && (kd != 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); + if (player.Enemy.HP <0) + { + player.Enemy.HP = 0; + } + kd = 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"); + kd = 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"); + kd = 3; + } + } + else + { + player.Enemy.HP = player.Enemy.HP - player.Strong; + Console.WriteLine("{0} deal damage to {1} : {2}", player, player.Enemy, player.Strong); + if (player.Enemy.HP<0) + { + player.Enemy.HP = 0; + } + Console.WriteLine("{0} have {1} ", player.Enemy, player.Enemy.HP); + + if ((kd > 0) && (kd < 4)) + { + kd--; + } + } + } + } + //link1: + Console.WriteLine(" "); + //turnNumber++; + } + + /*private static void Fight(Player player, int enemyNumber) + { + 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)]; + + // 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 ((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) + { + 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(" "); + } + }*/ + + /*private static void Fight(Player player) + { + int turnNumber = 1; + int[] cooldown = new int[numberOfPlayers]; + 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)]; + + // 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 ((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) + { + 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/Logger.cs b/RPG/Logger.cs new file mode 100644 index 0000000..4730291 --- /dev/null +++ b/RPG/Logger.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace RPG +{ + public static class Logger + { + public static void LUseAbility(Player player) + { + Console.WriteLine(player.ToString(), "{ 0} use his ultimate Abilitiy"); + } + public static void LTakeDamage(Player player, float damage) + { + Console.WriteLine(player.Enemy.ToString(), player.ToString(), damage, "{0}, take damage from {1} equal {2}"); + } + } +} 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..6cf6adc --- /dev/null +++ b/RPG/Player.cs @@ -0,0 +1,58 @@ +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 Player EnemyNumber { get; set; } = null; + public double HP { get; set; } = rnd.Next(70, 100); + public int Strong { get; } = rnd.Next(10, 20); + 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