From c67fc1ed6308e26af7999f7a6e67bb4dc55d1e8c Mon Sep 17 00:00:00 2001 From: Ines Barral Date: Fri, 8 Nov 2024 15:31:09 -0300 Subject: [PATCH 1/6] DamageCalculator documentacion --- src/Library/DamageCalculator.cs | 46 ++++++++++++++++++++++++++++++--- 1 file changed, 43 insertions(+), 3 deletions(-) diff --git a/src/Library/DamageCalculator.cs b/src/Library/DamageCalculator.cs index 6f12f93..4466c2b 100644 --- a/src/Library/DamageCalculator.cs +++ b/src/Library/DamageCalculator.cs @@ -10,9 +10,15 @@ namespace Library; // Es una clase abstracta la cual nos permite evitar que el programa tenga interdependencias innecesarias (Aplicando DIP). public static class DamageCalculator { + /// + /// Proporciona el valor de efectividad de los ataques entre diferentes tipos de Pokémon. + /// + /// + /// Diccionario donde la clave es una tupla que representa el tipo del ataque y el tipo del Pokemon objetivo, + /// y el valor es un factor de efectividad (2.0 para súper efectivo, 0.5 para poco efectivo, 0.0 para sin efecto). + /// private static Dictionary, double> EffectivnessDataBase { - // Izquierda tipo del ataque, derecha tipo del pokemon atacado get { Type fire = Type.Fire; @@ -117,7 +123,16 @@ private static Dictionary, double> EffectivnessDataBase return effectivnessDataBase; } } - + + /// + /// Obtiene la efectividad de un ataque de un tipo específico contra el o los tipos de un Pokemon. + /// + /// El tipo del ataque. + /// Una lista de los tipos del Pokemon objetivo. + /// + /// Valor double indicando el factor de efectividad del ataque. + /// 2.0 para súper efectivo, 0.5 para poco efectivo, 0.0 si no tiene efecto, y 1.0 si no hay una relación específica. + /// public static double GetEffectivness(Type type, List types) { foreach (Type type1 in types) @@ -137,6 +152,13 @@ public static double GetEffectivness(Type type, List types) return 1.0; } + /// + /// Determina si un ataque resulta en un golpe crítico basado en una probabilidad aleatoria. + /// + /// + /// Un valor double: 1.20 si el ataque es crítico (10% de probabilidad), + /// o 1.0 si no es crítico. + /// public static double CriticalCheck() { Random random = new Random(); @@ -147,7 +169,15 @@ public static double CriticalCheck() } return 1.0; } - + /// + /// Aplica un efecto especial al Pokemon objetivo, siempre y cuando el ataque recibido sea especial y el Pokemon no tenga ya otro efecto. + /// + /// El Pokemon que recibe el ataque. + /// El ataque ejecutado. + /// + /// Si el ataque es un y el Pokemon objetivo no tiene un estado actual, + /// se aplica el efecto especial del ataque y se setea su cooldown. + /// public static void SpecialCheck(Pokemon attackedPokemon, Attack attack) { if (attack is SpecialAttack specialAttack && attackedPokemon.CurrentState == null) @@ -157,6 +187,16 @@ public static void SpecialCheck(Pokemon attackedPokemon, Attack attack) } } + /// + /// Calcula el daño infligido a un Pokemon objetivo. Para esto tiene en cuenta el valor de ataque, la efectividad de tipos y + /// la probabilidad de golpe crítico, además de revisar si se trata de un ataque especial. + /// + /// El Pokemon que recibe el ataque. + /// El ataque que se está ejecutando. + /// + /// El daño calculado como un double. + /// Devuelve 0.0 si el ataque falla. + /// public static double CalculateDamage(Pokemon attackedPokemon, Attack attack) { Random random = new Random(); From 7d5c1677794232687f94fb6a78934927670d3960 Mon Sep 17 00:00:00 2001 From: Ines Barral Date: Fri, 8 Nov 2024 16:58:44 -0300 Subject: [PATCH 2/6] Documentacion fachada --- src/Library/Facade.cs | 107 +++++++++++++++++++++++++++++++++++++----- 1 file changed, 95 insertions(+), 12 deletions(-) diff --git a/src/Library/Facade.cs b/src/Library/Facade.cs index 4b598d0..d672773 100644 --- a/src/Library/Facade.cs +++ b/src/Library/Facade.cs @@ -2,13 +2,30 @@ namespace Library; + +/// +/// La clase Facade proporciona una interfaz simplificada para interactuar con el sistema de gestión de batallas Pokemon. +/// Incluye funcionalidades para gestionar listas de espera, partidas en curso, ataques, estados de juego, y mucho más. +/// public static class Facade { + /// + /// Lista de espera para jugadores que aún no están en una partida. + /// private static WaitingList WaitingList { get; } = new WaitingList(); - + + /// + /// Lista de partidas en curso. + /// public static GameList GameList{ get; } = new GameList(); - // historia de usuario 2 + /// + /// Historia de usuario 2: + /// Muestra los ataques disponibles del Pokemon activo de un jugador. + /// + /// Nombre del jugador activo. + /// Una lista de los ataques del Pokémon activo o un mensaje de error en + /// caso de que el jugador no exista. public static string ShowAtacks(string playerName) { @@ -25,8 +42,15 @@ public static string ShowAtacks(string playerName) return result; } - - // historia de usuario 3 + + /// + /// Historia de usuario 3: + /// Muestra los puntos de vida (HP) de los Pokemon de un jugador. + /// + /// Nombre del jugador. + /// Nombre del jugador cuya lista de Pokemon se va a comprobar (opcional). Si es + /// null hace referencia al propio jugador. Si no, hace referencia a otro. + /// Una lista de los Pokemon y sus HP o un mensaje de error. public static string ShowPokemonsHP(string playerName, string playerToCheckName = null) { Player player = GameList.FindPlayerByName(playerName); @@ -54,7 +78,12 @@ public static string ShowPokemonsHP(string playerName, string playerToCheckName } } - //Historia de usuario 5 + /// + /// Historia de usuario 5: + /// Comprueba si es el turno de un jugador y muestra las opciones disponibles. + /// + /// Nombre del jugador. + /// Mensaje indicando si es o no su turno, junto con las opciones. public static string CheckTurn(string playerName) { Player player = GameList.FindPlayerByName(playerName); @@ -73,7 +102,13 @@ public static string CheckTurn(string playerName) return null; } - //Historia de usuario 6 + /// + /// Historia de usuario 6: + /// Comprueba el estado de una partida y determina si continúa o hay un ganador. + /// + /// La partida actual. + /// "Próximo turno" en caso de que la partida siga o un string conteniendo el + /// ganador y el perdedor. public static string ChckGameStatus(Game game) { if (game.GameStatus()) @@ -83,7 +118,15 @@ public static string ChckGameStatus(Game game) return game.Winner(); } - //Historia de usuario 8 + /// + /// Historia de usuario 8 + /// Permite a un jugador usar un item en un Pokemon. + /// + /// Nombre del jugador. + /// Nombre del item a usar. + /// Nombre del Pokemon objetivo. + /// Resultado del uso del item. + public static string UseAnItem(string playerName, string item, string pokemon) { Player player = GameList.FindPlayerByName(playerName); @@ -103,7 +146,12 @@ public static string UseAnItem(string playerName, string item, string pokemon) } - // historia de usuario 9 + /// + /// Historia de usuario 9: + /// Agrega un jugador a la lista de espera. + /// + /// Nombre del jugador. + /// Mensaje indicando si el jugador fue agregado o ya estaba en la lista. public static string AddPlayerToWaitingList(string playerName) { if (WaitingList.AddPlayer(playerName)) @@ -111,13 +159,24 @@ public static string AddPlayerToWaitingList(string playerName) return $"{playerName} ya está en la lista de espera"; } + /// + /// Historia de usuario 9.1: + /// Remueve un jugador de la lista de espera. + /// + /// Nombre del jugador. + /// Mensaje indicando si el jugador fue removido o no estaba en la lista. public static string RemovePlayerFromWaitingList(string playerName) { if (WaitingList.RemovePlayer(playerName)) return $"{playerName} removido de la lista de espera"; return $"{playerName} no está en la lista de espera"; } - //historia de usuario 10 + + /// + /// Historia de usuario 10 + /// Muestra todos los jugadores actualmente en la lista de espera. + /// + /// Lista de jugadores en espera o un mensaje indicando que no hay nadie esperando. public static string GetAllPlayersWaiting() { if (WaitingList.Count == 0) @@ -133,7 +192,16 @@ public static string GetAllPlayersWaiting() return result; } - //historia de usuario 11 + + // + /// + /// Historia de usuario 11: + /// Crea una nueva partida entre dos jugadores, quitándolos de la lista de espera y agregando la partida a la lista de + /// juegos activos. + /// + /// Nombre del primer jugador. + /// Nombre del oponente. + /// Mensaje confirmando el inicio de la partida entre ambos jugadores. private static string CreateGame(string playerName, string opponentName) { Player player = WaitingList.FindPlayerByName(playerName); @@ -144,6 +212,12 @@ private static string CreateGame(string playerName, string opponentName) return $"Comienza {playerName} vs {opponentName}"; } + /// + /// Inicia una batalla entre dos jugadores, eligiendo un oponente específico o con el primer oponente disponible. + /// + /// Nombre del jugador que inicia la batalla. + /// Nombre del oponente (opcional). + /// string indicando si la batalla comenzó o si hubo algún error. public static string StartBattle(string playerName, string? opponentName) { Player? opponent; @@ -174,8 +248,13 @@ bool OpponentFound() } } - // Historia 1 - + /// + /// Historia 1: + /// Permite a un jugador agregar un Pokemon al equipo desde el catálogo. + /// + /// Nombre del jugador. + /// Nombre del Pokemon que se quiere añadir al equipo. + /// Mensaje indicando si el Pokemon fue añadido o si hubo un error. public static string ChooseTeam(string playerName, string cPokemon) { PokemonCatalogue.SetCatalogue(); @@ -202,6 +281,10 @@ public static string ChooseTeam(string playerName, string cPokemon) return $"El pokemon {cPokemon} no fue encontrado"; } + /// + /// Muestra el catálogo de Pokemon disponibles. + /// + /// Lista de Pokemon en el catálogo. public static string ShowCatalogue() { PokemonCatalogue.SetCatalogue(); From c835e0e5ed003a4130b050e90e63190bef28ed6c Mon Sep 17 00:00:00 2001 From: FacundoPiriz17 Date: Fri, 8 Nov 2024 17:56:29 -0300 Subject: [PATCH 3/6] added Chikorita --- src/Library/Facade.cs | 3 +- test/LibraryTests/ChikoritaTest.cs | 188 +++++++++++++++++++++++++++++ 2 files changed, 189 insertions(+), 2 deletions(-) create mode 100644 test/LibraryTests/ChikoritaTest.cs diff --git a/src/Library/Facade.cs b/src/Library/Facade.cs index ea44636..aabbb3b 100644 --- a/src/Library/Facade.cs +++ b/src/Library/Facade.cs @@ -16,7 +16,7 @@ public static string ChooseTeam(string playerName, string cPokemon) return "Para poder elegir un equipo, primero debes estar en una batalla"; } - if (player.GetPokemonTeam().Count == 6) + if (player.GetPokemonTeam().Count < 6) { if (cPokemon != null) { @@ -27,7 +27,6 @@ public static string ChooseTeam(string playerName, string cPokemon) player.AddToTeam(pokemon); return $"El pokemon {cPokemon} fue añadido al equipo"; } - return $"El pokemon {cPokemon} ya está en el equipo, no puedes volver a añadirlo"; } } diff --git a/test/LibraryTests/ChikoritaTest.cs b/test/LibraryTests/ChikoritaTest.cs new file mode 100644 index 0000000..32ba588 --- /dev/null +++ b/test/LibraryTests/ChikoritaTest.cs @@ -0,0 +1,188 @@ +using Library; +using NUnit.Framework; +using Type = Library.Type; + +namespace LibraryTests; + +[TestFixture] +[TestOf(typeof(Chikorita))] +public class ChikoritaTest +{ + [Test] + public void TestName() + { + Chikorita chikorita = new Chikorita(); + string chikoritaName = chikorita.Name; + string expectedName = "Chikorita"; + Assert.That(chikoritaName.Equals(expectedName, StringComparison.Ordinal)); + } + + [Test] + public void TestType() + { + Chikorita chikorita = new Chikorita(); + Type chikoritaType = chikorita.GetTypes()[0]; + Type expectedType = Type.Grass; + Assert.That(chikoritaType.Equals(expectedType)); + } + + [Test] + public void TestLifeAndCurrentLife() + { + Chikorita chikorita = new Chikorita(); + double chikoritaBaseLife = chikorita.BaseLife; + double expectedBaseLife = 294; + Assert.That(chikoritaBaseLife.Equals(expectedBaseLife)); + double chikoritaCurentLife = chikorita.CurrentLife; + double expectedCurrentLife = 294; + Assert.That(chikoritaCurentLife.Equals(expectedCurrentLife)); + } + + [Test] + public void TestIfItHasFourAttacks() + { + Chikorita chikorita = new Chikorita(); + List chikoritaAttacks = chikorita.GetAttacks(); + int expectedLenght = 4; + Assert.That(chikoritaAttacks.Count.Equals(expectedLenght)); + } + + [Test] + public void TestAddAFifthAttack() + { + Chikorita chikorita = new Chikorita(); + List chikoritaAttacks = chikorita.GetAttacks(); + Attack attack = new Attack("TestAttack", Type.Fire, 1, 1); + chikorita.AddAttack(attack); + int expectedLenght = 4; + Assert.That(chikoritaAttacks.Count.Equals(expectedLenght)); + } + + [Test] + public void TestCurrentStateAndEditState() + { + Chikorita chikorita = new Chikorita(); + State? chikoritaCurrentState = chikorita.CurrentState; + Assert.That(chikoritaCurrentState.Equals(null)); + chikorita.EditState(State.Burned); + State? chikoritaCurrentState2 = chikorita.CurrentState; + Assert.That(chikoritaCurrentState2.Equals(State.Burned)); + } + + [Test] + public void TestAsleepTurns() + { + Chikorita chikorita = new Chikorita(); + int chikoritaCurrentState = chikorita.AsleepTurns; + int expectedLenght = 0; + Assert.That(chikoritaCurrentState.Equals(expectedLenght)); + } + + [Test] + public void TestAttacks() + { + Chikorita chikorita = new Chikorita(); + Attack attack1 = chikorita.FindAttackByName("Razor leaf"); + string attack1Name = attack1.Name; + Type attack1Type = attack1.Type; + double attack1Accuracy = attack1.Accuracy; + int attack1Power = attack1.Power; + string attack1ExcpectedName = "Razor leaf"; + Type attack1ExcpectedType = Type.Grass; + double attack1ExcpectedAccuracy = 0.9; + int attack1ExcpectedPower = 35; + Assert.That(attack1Name.Equals(attack1ExcpectedName, StringComparison.Ordinal)); + Assert.That(attack1Type.Equals(attack1ExcpectedType)); + Assert.That(attack1Accuracy.Equals(attack1ExcpectedAccuracy)); + Assert.That(attack1Power.Equals(attack1ExcpectedPower)); + Attack attack2 = chikorita.FindAttackByName("Giga Drain"); + string attack2Name = attack2.Name; + Type attack2Type = attack2.Type; + double attack2Accuracy = attack2.Accuracy; + int attack2Power = attack2.Power; + string attack2ExcpectedName = "Giga Drain"; + Type attack2ExcpectedType = Type.Grass; + double attack2ExcpectedAccuracy = 0.95; + int attack2ExcpectedPower = 70; + if (attack2 is SpecialAttack specialAttack2) + { + State sAttack2SpecialEffect = specialAttack2.SpecialEffect; + int sAttack2Cooldown = specialAttack2.Cooldown; + State attack2ExcpectedSpecialEffect = State.Paralized; + int attack2ExcpectedCooldown = 0; + Assert.That(sAttack2SpecialEffect.Equals(attack2ExcpectedSpecialEffect)); + Assert.That(sAttack2Cooldown.Equals(attack2ExcpectedCooldown)); + + } + Assert.That(attack2Name.Equals(attack2ExcpectedName, StringComparison.Ordinal)); + Assert.That(attack2Type.Equals(attack2ExcpectedType)); + Assert.That(attack2Accuracy.Equals(attack2ExcpectedAccuracy)); + Assert.That(attack2Power.Equals(attack2ExcpectedPower)); + Attack attack3 = chikorita.FindAttackByName("Magical leaf"); + string attack3Name = attack3.Name; + Type attack3Type = attack3.Type; + double attack3Accuracy = attack3.Accuracy; + int attack3Power = attack3.Power; + string attack3ExcpectedName = "Magical leaf"; + Type attack3ExcpectedType = Type.Grass; + double attack3ExcpectedAccuracy = 1; + int attack3ExcpectedPower = 45; + Assert.That(attack3Name.Equals(attack3ExcpectedName, StringComparison.Ordinal)); + Assert.That(attack3Type.Equals(attack3ExcpectedType)); + Assert.That(attack3Accuracy.Equals(attack3ExcpectedAccuracy)); + Assert.That(attack3Power.Equals(attack3ExcpectedPower)); + Attack attack4 = chikorita.FindAttackByName("Body slam"); + string attack4Name = attack4.Name; + Type attack4Type = attack4.Type; + double attack4Accuracy = attack4.Accuracy; + int attack4Power = attack4.Power; + string attack4ExcpectedName = "Body slam"; + Type attack4ExcpectedType = Type.Normal; + double attack4ExcpectedAccuracy = 1; + int attack4ExcpectedPower = 55; + Assert.That(attack4Name.Equals(attack4ExcpectedName, StringComparison.Ordinal)); + Assert.That(attack4Type.Equals(attack4ExcpectedType)); + Assert.That(attack4Accuracy.Equals(attack4ExcpectedAccuracy)); + Assert.That(attack4Power.Equals(attack4ExcpectedPower)); + } + + [Test] + public void TestRestoreBaseLifeTakeDamageAndGetLife() + { + Chikorita chikorita = new Chikorita(); + double actualLife = chikorita.CurrentLife; + string actualLifeText = chikorita.GetLife(); + chikorita.GainLife(100); + Assert.That(actualLife.Equals(chikorita.BaseLife)); + Assert.That(actualLifeText.Equals("294/294", StringComparison.Ordinal)); + chikorita.TakeDamage(120); + double actualLife2 = chikorita.CurrentLife; + string actualLifeText2 = chikorita.GetLife(); + Assert.That(actualLife2.Equals(174)); + Assert.That(actualLifeText2.Equals("174/294", StringComparison.Ordinal)); + chikorita.GainLife(100); + double actualLife3 = chikorita.CurrentLife; + string actualLifeText3 = chikorita.GetLife(); + Assert.That(actualLife3.Equals(274)); + Assert.That(actualLifeText3.Equals("274/294", StringComparison.Ordinal)); + } + + [Test] + public void TestFindAttackByName() + { + Chikorita chikorita = new Chikorita(); + Attack attack = chikorita.FindAttackByName("Magical leaf"); + string attack1Name = attack.Name; + Type attack1Type = attack.Type; + double attack1Accuracy = attack.Accuracy; + int attack1Power = attack.Power; + string attack1ExcpectedName = "Magical leaf"; + Type attack1ExcpectedType = Type.Grass; + double attack1ExcpectedAccuracy = 1; + int attack1ExcpectedPower = 45; + Assert.That(attack1Name.Equals(attack1ExcpectedName, StringComparison.Ordinal)); + Assert.That(attack1Type.Equals(attack1ExcpectedType)); + Assert.That(attack1Accuracy.Equals(attack1ExcpectedAccuracy)); + Assert.That(attack1Power.Equals(attack1ExcpectedPower)); + } +} \ No newline at end of file From 7536aeb6806b6786361a7ffdba0aab524d950100 Mon Sep 17 00:00:00 2001 From: Ines Barral Date: Fri, 8 Nov 2024 17:56:52 -0300 Subject: [PATCH 4/6] Documentacion detalles --- src/Library/Facade.cs | 144 +++++++++++++++++++++++------------------- 1 file changed, 80 insertions(+), 64 deletions(-) diff --git a/src/Library/Facade.cs b/src/Library/Facade.cs index 046c500..70e4099 100644 --- a/src/Library/Facade.cs +++ b/src/Library/Facade.cs @@ -17,6 +17,41 @@ public static class Facade /// public static GameList GameList{ get; } = new GameList(); + /// + /// Historia 1: + /// Permite a un jugador agregar un Pokemon al equipo desde el catálogo. + /// + /// Nombre del jugador. + /// Nombre del Pokemon que se quiere añadir al equipo. + /// Mensaje indicando si el Pokemon fue añadido o si hubo un error. + public static string ChooseTeam(string playerName, string cPokemon) + { + PokemonCatalogue.SetCatalogue(); + Player player = GameList.FindPlayerByName(playerName); + + if (player == null) + { + return "Para poder elegir un equipo, primero debes estar en una batalla"; + } + if (player.GetPokemonTeam().Count < 6) + { + if (cPokemon != null) + { + foreach (Pokemon pokemon in PokemonCatalogue.SetCatalogue()) + { + if (pokemon.Name == cPokemon && !player.GetPokemonTeam().Contains(pokemon)) + { + player.AddToTeam(pokemon); + return $"El pokemon {cPokemon} fue añadido al equipo"; + } + return $"El pokemon {cPokemon} ya está en el equipo, no puedes volver a añadirlo"; + } + } + return $"El pokemon {cPokemon} no fue encontrado"; + } + return "El equipo está incompleto, por favor elige 6 pokemones para poder comenzar la batalla"; + } + /// /// Historia de usuario 2: /// Muestra los ataques disponibles del Pokemon activo de un jugador. @@ -69,6 +104,39 @@ public static string ShowPokemonsHP(string playerName, string playerToCheckName } } + /// + /// Historia de usuario 4: + /// Permite a un jugador elegir y ejecutar un ataque durante su turno en una partida. + /// + /// Nombre del jugador que realiza el ataque. + /// Nombre del ataque que se desea utilizar. + /// + /// Un mensaje que indica el resultado de la acción. + /// + public static string ChooseAttack(string playerName, string attackName) + { + Player player = GameList.FindPlayerByName(playerName); + if (player == null) + { + return "Para poder atacar necesitas estar en una batalla"; + } + Attack attack = player.FindAttack(attackName); + if (attack == null) + { + return $"El ataque {attackName} no pudo ser encontrado"; + } + foreach (Game game in GameList.GetGameList()) + { + if (game.GetPlayers().Contains(player)) + { + string gameResult = game.ExecuteAttack(attack); + game.NextTurn(); + return gameResult; + } + } + return "El ataque no pudo ser concretado"; + } + /// /// Historia de usuario 5: /// Comprueba si es el turno de un jugador y muestra las opciones disponibles. @@ -114,8 +182,16 @@ public static string CheckGameStatus(Game game) return "La partida no pudo ser encontrada"; } - - //Historia de usuario 7 + + /// + /// Historia de usuario 7: + /// Permite a un jugador activo cambiar su Pokemon actual durante su turno en una partida. + /// + /// Nombre del jugador que desea cambiar de Pokemon. + /// Nombre del Pokemon al que se desea cambiar. + /// + /// Un mensaje que indica el resultado de la acción. + /// public static string ChangePokemon(string playerName, string pokemonName) { Player player = GameList.FindPlayerByName(playerName); @@ -283,75 +359,15 @@ bool OpponentFound() } } - /// - /// Historia 1: - /// Permite a un jugador agregar un Pokemon al equipo desde el catálogo. - /// - /// Nombre del jugador. - /// Nombre del Pokemon que se quiere añadir al equipo. - /// Mensaje indicando si el Pokemon fue añadido o si hubo un error. - public static string ChooseTeam(string playerName, string cPokemon) - { - PokemonCatalogue.SetCatalogue(); - Player player = GameList.FindPlayerByName(playerName); - - if (player == null) - { - return "Para poder elegir un equipo, primero debes estar en una batalla"; - } - if (player.GetPokemonTeam().Count < 6) - { - if (cPokemon != null) - { - foreach (Pokemon pokemon in PokemonCatalogue.SetCatalogue()) - { - if (pokemon.Name == cPokemon && !player.GetPokemonTeam().Contains(pokemon)) - { - player.AddToTeam(pokemon); - return $"El pokemon {cPokemon} fue añadido al equipo"; - } - return $"El pokemon {cPokemon} ya está en el equipo, no puedes volver a añadirlo"; - } - } - return $"El pokemon {cPokemon} no fue encontrado"; - } - return "El equipo está incompleto, por favor elige 6 pokemones para poder comenzar la batalla"; - } - + /// /// Muestra el catálogo de Pokemon disponibles. /// /// Lista de Pokemon en el catálogo. - - public static string ShowCatalogue() { PokemonCatalogue.SetCatalogue(); return PokemonCatalogue.ShowCatalogue(); } - - public static string ChooseAttack(string playerName, string attackName) - { - Player player = GameList.FindPlayerByName(playerName); - if (player == null) - { - return "Para poder atacar necesitas estar en una batalla"; - } - Attack attack = player.FindAttack(attackName); - if (attack == null) - { - return $"El ataque {attackName} no pudo ser encontrado"; - } - foreach (Game game in GameList.GetGameList()) - { - if (game.GetPlayers().Contains(player)) - { - string gameResult = game.ExecuteAttack(attack); - game.NextTurn(); - return gameResult; - } - } - return "El ataque no pudo ser concretado"; - } - + } \ No newline at end of file From dfd7e3c6c1be54e6b120e8df3b1c0e8062b95004 Mon Sep 17 00:00:00 2001 From: FacundoPiriz17 Date: Fri, 8 Nov 2024 17:59:05 -0300 Subject: [PATCH 5/6] chikorita --- src/Program/Program.cs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/Program/Program.cs b/src/Program/Program.cs index b59a037..6c19bf0 100644 --- a/src/Program/Program.cs +++ b/src/Program/Program.cs @@ -5,7 +5,6 @@ //-------------------------------------------------------------------------------- using System; -using ClassLibrary; namespace ConsoleApplication { @@ -19,9 +18,7 @@ public static class Program /// public static void Main() { - var train = new Train(); - train.StartEngines(); - Console.WriteLine("Hello World!"); + } } } \ No newline at end of file From ec0f15705c62a373164171d059d87f55ea824d13 Mon Sep 17 00:00:00 2001 From: FacundoPiriz17 Date: Fri, 8 Nov 2024 18:00:52 -0300 Subject: [PATCH 6/6] a --- src/Program/Program.cs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/Program/Program.cs b/src/Program/Program.cs index b59a037..6c19bf0 100644 --- a/src/Program/Program.cs +++ b/src/Program/Program.cs @@ -5,7 +5,6 @@ //-------------------------------------------------------------------------------- using System; -using ClassLibrary; namespace ConsoleApplication { @@ -19,9 +18,7 @@ public static class Program /// public static void Main() { - var train = new Train(); - train.StartEngines(); - Console.WriteLine("Hello World!"); + } } } \ No newline at end of file