Skip to content

Commit

Permalink
Merge pull request #40 from ucudal/test-pokemons
Browse files Browse the repository at this point in the history
Test pokemons
  • Loading branch information
FacundoPiriz17 authored Nov 9, 2024
2 parents f9bccf4 + d14018d commit 3c6e4f4
Show file tree
Hide file tree
Showing 29 changed files with 1,731 additions and 88 deletions.
6 changes: 1 addition & 5 deletions src/Library/Attack.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ public class Attack : IAttack
public int Power {get; private set;}

/// <summary>
/// Constructor del ataque.
/// Asigna el nombre, tipo, precisión y potencia a un ataque a crear.
/// </summary>
/// <param name="name">Nombre del ataque a crear.</param>
Expand All @@ -51,9 +52,4 @@ public Attack(string name, Type type, double accuracy, int power)
this.Power =power;

}

public string GetAttack()
{
return $"";
}
}
4 changes: 2 additions & 2 deletions src/Library/Caterpie.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ namespace Library;
public class Caterpie: Pokemon
{
/// <summary>
/// Constructor de Caterpie.
/// Constructor de Caterpie, implementa el patron GRASP creator.
/// </summary>
public Caterpie():base(name: "Caterpie", life: 40, type: Library.Type.Bug, new Attack("Bug bite", Type.Bug, 1,20),new Attack("Tackle",Type.Normal,1,30),new SpecialAttack("Bug stomp", Type.Bug, 0.95,70, State.Paralized),new Attack("String shot", Type.Bug, 1,15))
public Caterpie():base(name: "Caterpie", life: 294, type: Library.Type.Bug, new Attack("Bug bite", Type.Bug, 1,20),new Attack("Tackle",Type.Normal,1,30),new SpecialAttack("Bug stomp", Type.Bug, 0.95,70, State.Paralized),new Attack("String shot", Type.Bug, 1,15))
{

}
Expand Down
2 changes: 1 addition & 1 deletion src/Library/Charizard.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace Library;
public class Charizard : Pokemon
{
/// <summary>
/// Constructor de Charizard.
/// Constructor de Charizard, implementa el patron GRASP creator.
/// </summary>
public Charizard():base(name: "Charizard", life: 360, type: Type.Fire, new Attack("Dragon claw",Type.Dragon,1,55),new SpecialAttack("Flamethrower",Type.Fire,0.95,75, State.Burned), new Attack("Wing Attack",Type.Flying,0.9,40), new Attack("Fire punch",Type.Fire,1,50))
{
Expand Down
2 changes: 1 addition & 1 deletion src/Library/Chikorita.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace Library;
public class Chikorita : Pokemon
{
/// <summary>
/// Constructor de Chikorita.
/// Constructor de Chikorita, implementa el patron GRASP creator.
/// </summary>
public Chikorita():base(name: "Chikorita", life: 294, type: Type.Grass,new Attack("Razor leaf",Type.Grass,0.9,35),new Attack("Magical leaf", Type.Grass,1,45),new SpecialAttack("Giga Drain",Type.Grass,0.95,70,State.Paralized), new Attack("Body slam",Type.Normal,1,55))
{
Expand Down
6 changes: 3 additions & 3 deletions src/Library/DamageCalculator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ public static class DamageCalculator
/// Proporciona el valor de efectividad de los ataques entre diferentes tipos de Pokémon.
/// </summary>
/// <returns>
/// 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).
/// <c>Dictionary</c> 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úperefectivo, 0.5 para poco efectivo, 0.0 para sin efecto).
/// </returns>
private static Dictionary<Tuple<Type, Type>, double> EffectivnessDataBase
{
Expand Down Expand Up @@ -129,7 +129,7 @@ private static Dictionary<Tuple<Type, Type>, double> EffectivnessDataBase
/// <param name="types">Una lista de los tipos del Pokemon objetivo.</param>
/// <returns>
/// Valor <c>double</c> indicando el factor de efectividad del ataque.
/// <c>2.0</c> para súper efectivo, <c>0.5</c> para poco efectivo, <c>0.0</c> si no tiene efecto, y <c>1.0</c> si no hay una relación específica.
/// <c>2.0</c> para súperefectivo, <c>0.5</c> para poco efectivo, <c>0.0</c> si no tiene efecto, y <c>1.0</c> si no hay una relación específica.
/// </returns>
public static double GetEffectivness(Type type, List<Type> types)
{
Expand Down
35 changes: 19 additions & 16 deletions src/Library/Facade.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public static class Facade
/// </summary>
/// <param name="playerName">Nombre del jugador.</param>
/// <param name="cPokemon">Nombre del Pokemon que se quiere añadir al equipo.</param>
/// <returns>Mensaje indicando si el Pokemon fue añadido o si hubo un error.</returns>
/// <returns>Mensaje <c>string</c> indicando si el Pokemon fue añadido, si ya estaba ne el equipo o si hubo un error.</returns>
public static string ChooseTeam(string playerName, string cPokemon)
{
PokemonCatalogue.SetCatalogue();
Expand All @@ -46,13 +46,16 @@ public static string ChooseTeam(string playerName, string cPokemon)
}
return $"El pokemon {cPokemon} fue añadido al equipo";
}

if (pokemon.Name == cPokemon && player.GetPokemonTeam().Contains(pokemon))
{
return $"El pokemon {cPokemon} ya está en el equipo, no puedes volver a añadirlo";
}
}
return $"El pokemon {cPokemon} ya está en el equipo, no puedes volver a añadirlo";
}
return $"El pokemon {cPokemon} no fue encontrado";
return $"El pokemon {cPokemon} no fue encontrado";
}
}

return "El equipo está incompleto, por favor elige 6 pokemones para poder comenzar la batalla";
return "Ya tienes 6 pokemones en el equipo, no puedes elegir más";
}


Expand All @@ -61,7 +64,7 @@ public static string ChooseTeam(string playerName, string cPokemon)
/// Muestra los ataques disponibles del Pokemon activo de un jugador.
/// </summary>
/// <param name="playerName">Nombre del jugador activo.</param>
/// <returns>Una lista de los ataques del Pokémon activo o un mensaje de error en
/// <returns>Un <c>string</c> de los ataques del Pokémon activo o un mensaje de error en
/// caso de que el jugador no exista.</returns>
public static string ShowAtacks(string playerName)
{
Expand All @@ -80,8 +83,8 @@ public static string ShowAtacks(string playerName)
/// <param name="playerName">Nombre del jugador.</param>
/// <param name="playerToCheckName">Nombre del jugador cuya lista de Pokemon se va a comprobar (opcional). Si es
/// <c>null</c> hace referencia al propio jugador. Si no, hace referencia a otro.</param>
/// <returns>Una lista de los Pokemon y sus HP o un mensaje de error.</returns>
public static string ShowPokemonsHP(string playerName, string playerToCheckName = null)
/// <returns>Un <c>string</c> de los Pokemon y sus HP o un mensaje de error.</returns>
public static string ShowPokemonsHp(string playerName, string playerToCheckName = null)
{
Player player = GameList.FindPlayerByName(playerName);
if (player == null)
Expand Down Expand Up @@ -117,7 +120,7 @@ public static string ShowPokemonsHP(string playerName, string playerToCheckName
/// <param name="playerName">Nombre del jugador que realiza el ataque.</param>
/// <param name="attackName">Nombre del ataque que se desea utilizar.</param>
/// <returns>
/// Un mensaje que indica el resultado de la acción.
/// Un mensaje <c>string</c> que indica el resultado de la acción.
/// </returns>
public static string ChooseAttack(string playerName, string attackName)
{
Expand Down Expand Up @@ -167,7 +170,7 @@ public static string ChooseAttack(string playerName, string attackName)
/// Comprueba si es el turno de un jugador y muestra las opciones disponibles.
/// </summary>
/// <param name="playerName">Nombre del jugador.</param>
/// <returns>Mensaje indicando si es o no su turno, junto con las opciones.</returns>
/// <returns>Mensaje <c>string</c> indicando si es o no su turno, junto con las opciones.</returns>
public static string CheckTurn(string playerName)
{
Player player = GameList.FindPlayerByName(playerName);
Expand Down Expand Up @@ -224,7 +227,7 @@ public static string CheckGameStatus(Game game)
/// <param name="playerName">Nombre del jugador que desea cambiar de Pokemon.</param>
/// <param name="pokemonName">Nombre del Pokemon al que se desea cambiar.</param>
/// <returns>
/// Un mensaje que indica el resultado de la acción.
/// Un mensaje <c>string</c> que indica el resultado de la acción.
/// </returns>
public static string ChangePokemon(string playerName, string pokemonName)
{
Expand Down Expand Up @@ -274,7 +277,7 @@ public static string ChangePokemon(string playerName, string pokemonName)
/// <param name="playerName">Nombre del jugador.</param>
/// <param name="item">Nombre del item a usar.</param>
/// <param name="pokemon">Nombre del Pokemon objetivo.</param>
/// <returns>Resultado del uso del item.</returns>
/// <returns>Resultado del uso del item <c>string</c>.</returns>
public static string UseAnItem(string playerName, string item, string pokemon)
{
Player player = GameList.FindPlayerByName(playerName);
Expand Down Expand Up @@ -314,7 +317,7 @@ public static string AddPlayerToWaitingList(string playerName)
/// Remueve un jugador de la lista de espera.
/// </summary>
/// <param name="playerName">Nombre del jugador.</param>
/// <returns>Mensaje indicando si el jugador fue removido o no estaba en la lista.</returns>
/// <returns>Mensaje <c>string</c> indicando si el jugador fue removido o no estaba en la lista.</returns>
public static string RemovePlayerFromWaitingList(string playerName)
{
if (WaitingList.RemovePlayer(playerName))
Expand Down Expand Up @@ -351,7 +354,7 @@ public static string GetAllPlayersWaiting()
/// </summary>
/// <param name="playerName">Nombre del primer jugador.</param>
/// <param name="opponentName">Nombre del oponente.</param>
/// <returns>Mensaje confirmando el inicio de la partida entre ambos jugadores.</returns>
/// <returns>Mensaje <c>string</c> confirmando el inicio de la partida entre ambos jugadores.</returns>
public static string CreateGame(string playerName, string opponentName)
{
Player player = WaitingList.FindPlayerByName(playerName);
Expand Down Expand Up @@ -408,7 +411,7 @@ bool OpponentFound()
/// <summary>
/// Muestra el catálogo de Pokemon disponibles.
/// </summary>
/// <returns>Lista de Pokemon en el catálogo.</returns>
/// <returns> <c>Lista</c> de Pokemon en el catálogo.</returns>
public static string ShowCatalogue()
{
PokemonCatalogue.SetCatalogue();
Expand Down
6 changes: 5 additions & 1 deletion src/Library/FullHealth.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
namespace Library;

/// <summary>
/// Esta clase representa una curación.
/// Esta clase representa el item FullHealth.
/// Al ser un item implementa la interfaz <see cref="IItem"/>.
/// </summary>
public class FullHealth : IItem
{
Expand All @@ -25,6 +26,9 @@ public string Use(Pokemon pokemon)
return "Pokemon no válido";
}

/// <summary>
/// Contructor de <see cref="FullHealth"/>
/// </summary>
public FullHealth()
{
this.Name = "Full Health";
Expand Down
5 changes: 5 additions & 0 deletions src/Library/Game.cs
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,11 @@ public string ChangePokemon(Pokemon pokemon)
return $"{pokemon.Name} no tiene vida. Suerte bro, lo siento :/";
}

/// <summary>
/// Busca si hay un jugador con el mismo nombre que el del parámetro en una partida.
/// </summary>
/// <param name="checkPlayer"> El jugador a buscar</param>
/// <returns> <c>true</c> si lo encontró, <c>false</c> en caso contrario </returns>
public bool CheckPlayerInGame(Player checkPlayer)
{
if (checkPlayer != null)
Expand Down
2 changes: 1 addition & 1 deletion src/Library/Gengar.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace Library;
public class Gengar : Pokemon
{
/// <summary>
/// Constructor de Gengar.
/// Constructor de Gengar, implementa el patron GRASP creator.
/// </summary>
public Gengar():base(name: "Gengar", life: 324, type: Type.Ghost, new Attack("Shadow Ball",Type.Ghost,1,60),new SpecialAttack("Sludge Bomb", Type.Poison,0.95,70,State.Poisoned), new Attack("Shadow Punch", Type.Ghost, 0.75,100),new Attack("Focus Punch", Type.Normal, 0.45,155))
{
Expand Down
10 changes: 9 additions & 1 deletion src/Library/Haxorus.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
namespace Library;

/// <summary>
/// Esta clase representa el Pokemon Haxorus.
/// Al ser un Pokemon hereda de la clase <see cref="Pokemon"/>.
/// </summary>
public class Haxorus: Pokemon
{
public Haxorus():base(name: "Haxorus", life: 356, type: Type.Dragon, new Attack("Outrage",Type.Dragon,0.75,120),new Attack("Assurance", Type.Normal,0.95,80), new Attack("Close Combat", Type.Fighting, 0.75,120) ,new Attack("Dragon claw", Type.Dragon, 1,55)) {
/// <summary>
/// Constructor de Haxorus, implementa el patron GRASP creator.
/// </summary>
public Haxorus():base(name: "Haxorus", life: 356, type: Type.Dragon, new Attack("Outrage",Type.Dragon,0.75,120),new Attack("Assurance", Type.Normal,0.95,80), new Attack("Close Combat", Type.Fighting, 0.75,120) ,new Attack("Dragon claw", Type.Dragon, 1,55))
{
}
}
3 changes: 3 additions & 0 deletions src/Library/IAttack.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ public interface IAttack
/// Tipo del ataque.
/// </summary>
public Type Type {get;}
/// <summary>
/// Precisión del ataque.
/// </summary>
public double Accuracy {get;}

}
Loading

0 comments on commit 3c6e4f4

Please sign in to comment.