From f6648e4b5c881460d741c00e1d22353e9cbccf6e Mon Sep 17 00:00:00 2001 From: EwvwGeN Date: Sat, 3 Dec 2022 14:31:46 +0300 Subject: [PATCH 1/4] RPG saga v 0.1 --- CourseApp/Game.cs | 151 ++++++++++++++++++++++++++++++++ CourseApp/GameClasses/Archer.cs | 30 +++++++ CourseApp/GameClasses/Knight.cs | 30 +++++++ CourseApp/GameClasses/Mage.cs | 30 +++++++ CourseApp/Logger.cs | 71 +++++++++++++++ CourseApp/Player.cs | 95 ++++++++++++++++++++ CourseApp/Program.cs | 4 +- 7 files changed, 408 insertions(+), 3 deletions(-) create mode 100644 CourseApp/Game.cs create mode 100644 CourseApp/GameClasses/Archer.cs create mode 100644 CourseApp/GameClasses/Knight.cs create mode 100644 CourseApp/GameClasses/Mage.cs create mode 100644 CourseApp/Logger.cs create mode 100644 CourseApp/Player.cs diff --git a/CourseApp/Game.cs b/CourseApp/Game.cs new file mode 100644 index 0000000..9e18524 --- /dev/null +++ b/CourseApp/Game.cs @@ -0,0 +1,151 @@ +namespace CourseApp +{ + using System; + using System.Collections.Generic; + using System.Linq; + + public class Game + { + public static void Start() + { + int p_number = AskNumber(); + List playerList = PlayerListGenerator(p_number); + RandomizeList(ref playerList); + PlayGame(ref playerList); + } + + private static void PlayGame(ref List playerList) + { + for (int i = 1; playerList.Count != 1; i++) + { + Logger.WriteRound(i); + PlayRound(ref playerList); + } + + Logger.WriteWinner(playerList[0]); + } + + private static void PlayRound(ref List playerList) + { + for (int i = 0; i < playerList.Count / 2; i++) + { + Player[] fightMembers = { playerList[i * 2], playerList[(i * 2) + 1] }; + Logger.WriteFight(fightMembers); + playerList[i * 2] = PlayFight(fightMembers); + } + + for (int i = 1; i < playerList.Count; i++) + { + playerList.RemoveAt(i); + } + } + + private static Player PlayFight(Player[] fightMembers) + { + for (int i = 0; true; i++) + { + var playerStatus = fightMembers[i % 2].CheckStatus(); + Logger.WriteAction(fightMembers[i % 2], playerStatus); + bool checkDeath = fightMembers[i % 2].CheckDeath(); + if (checkDeath) + { + fightMembers[(i + 1) % 2].Update(); + return fightMembers[(i + 1) % 2]; + } + + if (playerStatus.Contains(Tuple.Create("Заворожение", .0f))) + { + continue; + } + + Tuple playerAction = PlayerDoAction(fightMembers[i % 2]); + Logger.WriteAction(fightMembers[i % 2], fightMembers[(i + 1) % 2], playerAction); + checkDeath = fightMembers[(i + 1) % 2].GetDamage(playerAction.Item2); + Logger.WriteDeath(fightMembers[(i + 1) % 2], checkDeath); + if (checkDeath) + { + fightMembers[i % 2].Update(); + return fightMembers[i % 2]; + } + } + } + + private static Tuple PlayerDoAction(Player inputP) + { + Random rnd = new Random(); + int chosen = rnd.Next(0, 5); + switch (chosen) + { + case 0: + return inputP.Ability(); + default: + return inputP.Attack(); + } + } + + private static int AskNumber() + { + while (true) + { + Console.WriteLine("Введите четное количество игроков:"); + int p_number = Convert.ToInt32(Console.ReadLine()); + if (p_number <= 0) + { + Console.WriteLine("Число игроков должно быть больше 0!"); + } + else if (p_number % 2 != 0) + { + Console.WriteLine("Число игроков должно быть четным!"); + } + else + { + return p_number; + } + } + } + + private static void RandomizeList(ref List input) + { + Random rnd = new Random(); + var buffer = input.ToArray(); + for (int i = 0; i < input.Count; i++) + { + int chosen = rnd.Next(i, buffer.Length); + (buffer[i], buffer[chosen]) = (buffer[chosen], buffer[i]); + } + + input = buffer.ToList(); + } + + private static List PlayerListGenerator(int count) + { + List playerList = new List(); + for (int i = 0; i < count; i++) + { + playerList.Add(PlayerGenerator()); + } + + return playerList; + } + + private static Player PlayerGenerator() + { + string[] names = { "Вальлиикт", "Йоророу", "Бенинэл", "Билелгар", "Вилдровер", "Бреновуд", "Труеон", "Филдис", "Грейнерэл", "Бертэам", "Ирвдес", "Франкернон", "Куртдитор" }; + Random rnd = new Random(); + int health = (int)rnd.NextInt64(1, 64); + int strength = (int)rnd.NextInt64(1, 64); + int chouse = (int)rnd.NextInt64(0, 3); + switch (chouse) + { + case 0: + return new Knight(health, strength, names[rnd.Next(names.Length)]); + case 1: + return new Mage(health, strength, names[rnd.Next(names.Length)]); + case 2: + return new Archer(health, strength, names[rnd.Next(names.Length)]); + default: + return new Knight(health, strength, names[rnd.Next(names.Length)]); + } + } + } +} \ No newline at end of file diff --git a/CourseApp/GameClasses/Archer.cs b/CourseApp/GameClasses/Archer.cs new file mode 100644 index 0000000..a74efe0 --- /dev/null +++ b/CourseApp/GameClasses/Archer.cs @@ -0,0 +1,30 @@ +namespace CourseApp +{ + using System; + + public class Archer : Player + { + public Archer(int health, int strength, string name) + : base(health, strength, name, "Огненные стрелы", 1) + { + } + + public override string ToString() + { + return "(Лучник) " + Name; + } + + public override Tuple Ability() + { + if (AbilityLeft > 0) + { + AbilityLeft--; + return Tuple.Create(AbilityName, 0.0f); + } + else + { + return Attack(); + } + } + } +} \ No newline at end of file diff --git a/CourseApp/GameClasses/Knight.cs b/CourseApp/GameClasses/Knight.cs new file mode 100644 index 0000000..b498034 --- /dev/null +++ b/CourseApp/GameClasses/Knight.cs @@ -0,0 +1,30 @@ +namespace CourseApp +{ + using System; + + public class Knight : Player + { + public Knight(int health, int strength, string name) + : base(health, strength, name, "Удар возмездия", 1) + { + } + + public override string ToString() + { + return "(Рыцарь) " + Name; + } + + public override Tuple Ability() + { + if (AbilityLeft > 0) + { + AbilityLeft--; + return Tuple.Create(AbilityName, Strength * 1.3f); + } + else + { + return Attack(); + } + } + } +} \ No newline at end of file diff --git a/CourseApp/GameClasses/Mage.cs b/CourseApp/GameClasses/Mage.cs new file mode 100644 index 0000000..70f9eed --- /dev/null +++ b/CourseApp/GameClasses/Mage.cs @@ -0,0 +1,30 @@ +namespace CourseApp +{ + using System; + + public class Mage : Player + { + public Mage(int health, int strength, string name) + : base(health, strength, name, "Заворожение", 1) + { + } + + public override string ToString() + { + return "(Маг) " + Name; + } + + public override Tuple Ability() + { + if (AbilityLeft > 0) + { + AbilityLeft--; + return Tuple.Create(AbilityName, 0.0f); + } + else + { + return Attack(); + } + } + } +} \ No newline at end of file diff --git a/CourseApp/Logger.cs b/CourseApp/Logger.cs new file mode 100644 index 0000000..2610ec1 --- /dev/null +++ b/CourseApp/Logger.cs @@ -0,0 +1,71 @@ +namespace CourseApp +{ + using System; + using System.Collections.Generic; + + public static class Logger + { + public static void WriteWinner(Player winner) + { + Console.WriteLine($"{winner.ToString()} ПОБЕДИЛ!"); + } + + public static void WriteRound(int round) + { + Console.WriteLine($"Раунд {round}."); + } + + public static void WriteFight(Player[] fightMembers) + { + Console.WriteLine($"{fightMembers[0].ToString()} VS {fightMembers[1].ToString()}"); + } + + public static void WriteAction(Player firstP, Player secondP, Tuple playerAction) + { + switch (playerAction.Item1) + { + case "наносит урон": + Console.WriteLine($"{firstP.ToString()} наносит урон {playerAction.Item2} противнику {secondP.ToString()}"); + break; + case "Удар возмездия": + Console.WriteLine($"{firstP.ToString()} применяет ({playerAction.Item1}) и наносит урон {playerAction.Item2} противнику {secondP.ToString()}"); + break; + case "Огненная стрела": + Console.WriteLine($"{firstP.ToString()} применяет ({playerAction.Item1}) по противнику {secondP.ToString()}"); + break; + case "Заворожение": + Console.WriteLine($"{firstP.ToString()} применяет ({playerAction.Item1}) по противнику {secondP.ToString()}"); + break; + } + } + + public static void WriteAction(Player inputP, List> playerStatus) + { + foreach (var debaff in playerStatus) + { + switch (debaff.Item1) + { + case "Огненная стрела": + Console.WriteLine($"{inputP.ToString()} получает периодический урон {debaff.Item2} от ({debaff.Item1})"); + break; + case "Заворожение": + Console.WriteLine($"{inputP.ToString()} пропускает ход из-за ({debaff.Item1})"); + break; + case "PlayerIsDied": + Console.WriteLine($"{inputP.ToString()} погибает"); + Console.WriteLine(); + break; + } + } + } + + public static void WriteDeath(Player inputP, bool isDeath) + { + if (isDeath) + { + Console.WriteLine($"{inputP.ToString()} погибает"); + Console.WriteLine(); + } + } + } +} \ No newline at end of file diff --git a/CourseApp/Player.cs b/CourseApp/Player.cs new file mode 100644 index 0000000..8a57785 --- /dev/null +++ b/CourseApp/Player.cs @@ -0,0 +1,95 @@ +namespace CourseApp +{ + using System; + using System.Collections.Generic; + + public abstract class Player + { + private List debaffs; + + public Player(int maxHealth, int strength, string name, string abilityName, int maxAbilityUsages) + { + this.MaxHealth = maxHealth; + this.CurrentHealth = maxHealth; + this.Strength = strength; + this.Name = name; + this.AbilityName = abilityName; + this.MaxAbilityUsages = maxAbilityUsages; + this.debaffs = new List(); + } + + public float MaxHealth { get; protected set; } + + public float CurrentHealth { get; protected set; } + + public float Strength { get; protected set; } + + public string Name { get; protected set; } + + public int MaxAbilityUsages { get; protected set; } + + public int AbilityLeft { get; protected set; } + + public string AbilityName { get; protected set; } + + public abstract Tuple Ability(); + + public Tuple Attack() + { + return Tuple.Create("наносит урон", Strength); + } + + public bool GetDamage(float damage) + { + CurrentHealth -= damage; + return CheckDeath(); + } + + public void SetDebaff(string debuffName) + { + debaffs.Add(debuffName); + } + + public List> CheckStatus() + { + List> returnedList = new List>(); + foreach (string debuffName in debaffs) + { + switch (debuffName) + { + case "Огненная стрела": + returnedList.Add(Tuple.Create("Огненная стрела", 2.0f)); + if (GetDamage(2)) + { + returnedList.Add(Tuple.Create("PlayerIsDied", 1.0f)); + return returnedList; + } + + break; + case "Заворожение": + returnedList.Add(Tuple.Create("Заворожение", .0f)); + break; + } + } + + return returnedList; + } + + public bool CheckDeath() + { + if (CurrentHealth <= 0) + { + return true; + } + + return false; + } + + public void Update() + { + AbilityLeft = MaxAbilityUsages; + CurrentHealth = MaxHealth; + debaffs.Clear(); + } + } +} \ No newline at end of file diff --git a/CourseApp/Program.cs b/CourseApp/Program.cs index d6d2c87..ab6cbb4 100644 --- a/CourseApp/Program.cs +++ b/CourseApp/Program.cs @@ -1,12 +1,10 @@ namespace CourseApp { - using System; - public class Program { public static void Main(string[] args) { - Console.WriteLine("Hello World"); + Game.Start(); } } } From 26262881cd2afdf9f536086eb66ce915d69f8307 Mon Sep 17 00:00:00 2001 From: EwvwGeN Date: Sun, 4 Dec 2022 13:00:54 +0300 Subject: [PATCH 2/4] fixed bugs with ability --- CourseApp/Game.cs | 7 ++++++- CourseApp/GameClasses/Archer.cs | 2 +- CourseApp/GameClasses/Knight.cs | 2 +- CourseApp/Player.cs | 6 +++++- 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/CourseApp/Game.cs b/CourseApp/Game.cs index 9e18524..f953d89 100644 --- a/CourseApp/Game.cs +++ b/CourseApp/Game.cs @@ -60,6 +60,11 @@ private static Player PlayFight(Player[] fightMembers) Tuple playerAction = PlayerDoAction(fightMembers[i % 2]); Logger.WriteAction(fightMembers[i % 2], fightMembers[(i + 1) % 2], playerAction); + if (playerAction.Item1 != "наносит урон") + { + fightMembers[(i + 1) % 2].SetDebaff(playerAction.Item1); + } + checkDeath = fightMembers[(i + 1) % 2].GetDamage(playerAction.Item2); Logger.WriteDeath(fightMembers[(i + 1) % 2], checkDeath); if (checkDeath) @@ -73,7 +78,7 @@ private static Player PlayFight(Player[] fightMembers) private static Tuple PlayerDoAction(Player inputP) { Random rnd = new Random(); - int chosen = rnd.Next(0, 5); + int chosen = rnd.Next(0, 4); switch (chosen) { case 0: diff --git a/CourseApp/GameClasses/Archer.cs b/CourseApp/GameClasses/Archer.cs index a74efe0..d654050 100644 --- a/CourseApp/GameClasses/Archer.cs +++ b/CourseApp/GameClasses/Archer.cs @@ -5,7 +5,7 @@ namespace CourseApp public class Archer : Player { public Archer(int health, int strength, string name) - : base(health, strength, name, "Огненные стрелы", 1) + : base(health, strength, name, "Огненная стрела", 1) { } diff --git a/CourseApp/GameClasses/Knight.cs b/CourseApp/GameClasses/Knight.cs index b498034..2e72c76 100644 --- a/CourseApp/GameClasses/Knight.cs +++ b/CourseApp/GameClasses/Knight.cs @@ -19,7 +19,7 @@ public override Tuple Ability() if (AbilityLeft > 0) { AbilityLeft--; - return Tuple.Create(AbilityName, Strength * 1.3f); + return Tuple.Create(AbilityName, (float)Math.Round(Strength * 1.3f, 2)); } else { diff --git a/CourseApp/Player.cs b/CourseApp/Player.cs index 8a57785..01b4bd5 100644 --- a/CourseApp/Player.cs +++ b/CourseApp/Player.cs @@ -15,6 +15,7 @@ public Player(int maxHealth, int strength, string name, string abilityName, int this.Name = name; this.AbilityName = abilityName; this.MaxAbilityUsages = maxAbilityUsages; + this.AbilityLeft = maxAbilityUsages; this.debaffs = new List(); } @@ -53,7 +54,9 @@ public void SetDebaff(string debuffName) public List> CheckStatus() { List> returnedList = new List>(); - foreach (string debuffName in debaffs) + string[] buffer = new string[debaffs.Count]; + debaffs.CopyTo(buffer); + foreach (string debuffName in buffer) { switch (debuffName) { @@ -68,6 +71,7 @@ public List> CheckStatus() break; case "Заворожение": returnedList.Add(Tuple.Create("Заворожение", .0f)); + debaffs.RemoveAt(debaffs.IndexOf(debuffName)); break; } } From bf1b56e26fb0c26e6298df5d3f861f02125097d6 Mon Sep 17 00:00:00 2001 From: EwvwGeN Date: Thu, 12 Jan 2023 15:51:53 +0300 Subject: [PATCH 3/4] some fixes --- .vscode/launch.json | 24 ++++++++++++++++++++++++ .vscode/settings.json | 4 ++-- .vscode/tasks.json | 41 +++++++++++++++++++++++++++++++++++++++++ CourseApp/Game.cs | 26 +++++++++++--------------- CourseApp/Logger.cs | 9 +++------ 5 files changed, 81 insertions(+), 23 deletions(-) create mode 100644 .vscode/launch.json create mode 100644 .vscode/tasks.json diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..1ff692c --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,24 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "name": ".NET Core Launch (console)", + "type": "coreclr", + "request": "launch", + "preLaunchTask": "build", + "program": "${workspaceFolder}/CourseApp/bin/Debug/net6.0/CourseApp.dll", + "args": [], + "cwd": "${workspaceFolder}/CourseApp", + "console": "integratedTerminal", + "stopAtEntry": false + }, + { + "name": ".NET Core Attach", + "type": "coreclr", + "request": "attach" + } + ] +} \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json index e2cc5c5..009e1aa 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -4,8 +4,8 @@ "**/.svn": true, "**/CVS": true, "**/.DS_Store": true, - "CourseApp": true, - "CourseApp.Tests":true, + "CourseApp": false, + "CourseApp.Tests":false, "WebApplication":true } } \ No newline at end of file diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 0000000..742612d --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,41 @@ +{ + "version": "2.0.0", + "tasks": [ + { + "label": "build", + "command": "dotnet", + "type": "process", + "args": [ + "build", + "${workspaceFolder}/CourseApp/CourseApp.csproj", + "/property:GenerateFullPaths=true", + "/consoleloggerparameters:NoSummary" + ], + "problemMatcher": "$msCompile" + }, + { + "label": "publish", + "command": "dotnet", + "type": "process", + "args": [ + "publish", + "${workspaceFolder}/CourseApp/CourseApp.csproj", + "/property:GenerateFullPaths=true", + "/consoleloggerparameters:NoSummary" + ], + "problemMatcher": "$msCompile" + }, + { + "label": "watch", + "command": "dotnet", + "type": "process", + "args": [ + "watch", + "run", + "--project", + "${workspaceFolder}/CourseApp/CourseApp.csproj" + ], + "problemMatcher": "$msCompile" + } + ] +} \ No newline at end of file diff --git a/CourseApp/Game.cs b/CourseApp/Game.cs index f953d89..298a349 100644 --- a/CourseApp/Game.cs +++ b/CourseApp/Game.cs @@ -2,7 +2,6 @@ namespace CourseApp { using System; using System.Collections.Generic; - using System.Linq; public class Game { @@ -10,22 +9,22 @@ public static void Start() { int p_number = AskNumber(); List playerList = PlayerListGenerator(p_number); - RandomizeList(ref playerList); - PlayGame(ref playerList); + RandomizeList(playerList); + PlayGame(playerList); } - private static void PlayGame(ref List playerList) + private static void PlayGame(List playerList) { for (int i = 1; playerList.Count != 1; i++) { Logger.WriteRound(i); - PlayRound(ref playerList); + PlayRound(playerList); } Logger.WriteWinner(playerList[0]); } - private static void PlayRound(ref List playerList) + private static void PlayRound(List playerList) { for (int i = 0; i < playerList.Count / 2; i++) { @@ -60,15 +59,15 @@ private static Player PlayFight(Player[] fightMembers) Tuple playerAction = PlayerDoAction(fightMembers[i % 2]); Logger.WriteAction(fightMembers[i % 2], fightMembers[(i + 1) % 2], playerAction); - if (playerAction.Item1 != "наносит урон") + if ((playerAction.Item1 != "наносит урон") && (playerAction.Item1 != "Удар возмездия")) { fightMembers[(i + 1) % 2].SetDebaff(playerAction.Item1); } checkDeath = fightMembers[(i + 1) % 2].GetDamage(playerAction.Item2); - Logger.WriteDeath(fightMembers[(i + 1) % 2], checkDeath); if (checkDeath) { + Logger.WriteDeath(fightMembers[(i + 1) % 2]); fightMembers[i % 2].Update(); return fightMembers[i % 2]; } @@ -109,17 +108,14 @@ private static int AskNumber() } } - private static void RandomizeList(ref List input) + private static void RandomizeList(List input) { Random rnd = new Random(); - var buffer = input.ToArray(); for (int i = 0; i < input.Count; i++) { - int chosen = rnd.Next(i, buffer.Length); - (buffer[i], buffer[chosen]) = (buffer[chosen], buffer[i]); + int chosen = rnd.Next(i, input.Count); + (input[i], input[chosen]) = (input[chosen], input[i]); } - - input = buffer.ToList(); } private static List PlayerListGenerator(int count) @@ -137,7 +133,7 @@ private static Player PlayerGenerator() { string[] names = { "Вальлиикт", "Йоророу", "Бенинэл", "Билелгар", "Вилдровер", "Бреновуд", "Труеон", "Филдис", "Грейнерэл", "Бертэам", "Ирвдес", "Франкернон", "Куртдитор" }; Random rnd = new Random(); - int health = (int)rnd.NextInt64(1, 64); + int health = (int)rnd.NextInt64(1, 64); int strength = (int)rnd.NextInt64(1, 64); int chouse = (int)rnd.NextInt64(0, 3); switch (chouse) diff --git a/CourseApp/Logger.cs b/CourseApp/Logger.cs index 2610ec1..88ca952 100644 --- a/CourseApp/Logger.cs +++ b/CourseApp/Logger.cs @@ -59,13 +59,10 @@ public static void WriteAction(Player inputP, List> playerS } } - public static void WriteDeath(Player inputP, bool isDeath) + public static void WriteDeath(Player inputP) { - if (isDeath) - { - Console.WriteLine($"{inputP.ToString()} погибает"); - Console.WriteLine(); - } + Console.WriteLine($"{inputP.ToString()} погибает"); + Console.WriteLine(); } } } \ No newline at end of file From 9282d4a0d51b5d5c77e80a183f0e8f2c5d30a0b0 Mon Sep 17 00:00:00 2001 From: EwvwGeN Date: Thu, 12 Jan 2023 19:15:11 +0300 Subject: [PATCH 4/4] last changes --- CourseApp/Game.cs | 4 ++-- CourseApp/Logger.cs | 3 +-- CourseApp/Player.cs | 3 ++- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/CourseApp/Game.cs b/CourseApp/Game.cs index 298a349..924cc66 100644 --- a/CourseApp/Game.cs +++ b/CourseApp/Game.cs @@ -9,7 +9,6 @@ public static void Start() { int p_number = AskNumber(); List playerList = PlayerListGenerator(p_number); - RandomizeList(playerList); PlayGame(playerList); } @@ -18,6 +17,7 @@ private static void PlayGame(List playerList) for (int i = 1; playerList.Count != 1; i++) { Logger.WriteRound(i); + RandomizeList(playerList); PlayRound(playerList); } @@ -133,7 +133,7 @@ private static Player PlayerGenerator() { string[] names = { "Вальлиикт", "Йоророу", "Бенинэл", "Билелгар", "Вилдровер", "Бреновуд", "Труеон", "Филдис", "Грейнерэл", "Бертэам", "Ирвдес", "Франкернон", "Куртдитор" }; Random rnd = new Random(); - int health = (int)rnd.NextInt64(1, 64); + int health = (int)rnd.NextInt64(1, 64); int strength = (int)rnd.NextInt64(1, 64); int chouse = (int)rnd.NextInt64(0, 3); switch (chouse) diff --git a/CourseApp/Logger.cs b/CourseApp/Logger.cs index 88ca952..01e9251 100644 --- a/CourseApp/Logger.cs +++ b/CourseApp/Logger.cs @@ -52,8 +52,7 @@ public static void WriteAction(Player inputP, List> playerS Console.WriteLine($"{inputP.ToString()} пропускает ход из-за ({debaff.Item1})"); break; case "PlayerIsDied": - Console.WriteLine($"{inputP.ToString()} погибает"); - Console.WriteLine(); + WriteDeath(inputP); break; } } diff --git a/CourseApp/Player.cs b/CourseApp/Player.cs index 01b4bd5..bfcbb8d 100644 --- a/CourseApp/Player.cs +++ b/CourseApp/Player.cs @@ -2,6 +2,7 @@ namespace CourseApp { using System; using System.Collections.Generic; + using System.Linq; public abstract class Player { @@ -62,7 +63,7 @@ public List> CheckStatus() { case "Огненная стрела": returnedList.Add(Tuple.Create("Огненная стрела", 2.0f)); - if (GetDamage(2)) + if (GetDamage(returnedList.Last().Item2)) { returnedList.Add(Tuple.Create("PlayerIsDied", 1.0f)); return returnedList;