Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Algunos comentarios agregados a clases generales #108

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/Library/Attack.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@ public Attack(string name, Type type, double accuracy, int power)
this.Power =power;
}


/// <summary>
/// Genera una descripción formateada del ataque.
/// Incluye el nombre, tipo, precisión y potencia del ataque.
/// </summary>
public string InfoAttack()
{
return $"**{this.Name}**: tipo *{this.Type}*, precisión *{this.Accuracy*100}*, potencia *{this.Power}*\n";
Expand Down
3 changes: 1 addition & 2 deletions src/Library/DamageCalculator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,12 @@ namespace Library;

// Es una clase a la cual le delegamos la función de calcular el daño para aplicar SRP así game tiene una única responsabilidad
// Es la clase Experta al momento de calcular daño
// Es una clase abstracta la cual nos permite evitar que el programa tenga interdependencias innecesarias (Aplicando DIP).
public class DamageCalculator
{
private IStrategyCritCheck StrategyCritCheck { get; set; }

/// <summary>
/// Proporciona el valor de efectividad de los ataques entre diferentes tipos de Pokémon.
/// Proporciona el valor de efectividad de los ataques entre diferentes tipos de Pokemon.
/// </summary>
/// <returns>
/// <c>Dictionary</c> Diccionario donde la clave es una tupla que representa el tipo del ataque y el tipo del Pokemon objetivo,
Expand Down
13 changes: 11 additions & 2 deletions src/Library/Facade.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ public class Facade

private PokemonCatalogue Pokedex { get; } = PokemonCatalogue.Instance;


/// <summary>
/// Crea una nueva instancia de Fachada si aún no existe.
/// </summary>
public static Facade Instance
{
get
Expand All @@ -41,11 +43,18 @@ public static Facade Instance
}
}

/// <summary>
/// Restablece la instancia a null, permitiendo crear una nueva.
/// </summary>
public void Reset()
{
_instance = null;
}

/// <summary>
/// Constructor de la clase Facade.
/// Inicializa las listas de espera y de juegos.
/// </summary>
private Facade()
{
this.WaitingList = new WaitingList();
Expand Down Expand Up @@ -277,7 +286,7 @@ public string CheckTurn(string playerName)
/// Comprueba el estado de una partida y determina si continúa o hay un ganador.
/// </summary>
/// <param name="game">La partida actual.</param>
/// <returns><c>"Próximo turno"</c> en caso de que la partida siga o un <c>string</c> conteniendo el
/// <returns><c>"Próximo turno, ahora es el turno de..."</c> en caso de que la partida siga o un <c>string</c> conteniendo el
/// ganador y el perdedor.</returns>
public string CheckGameStatus(Game game)
{
Expand Down
4 changes: 2 additions & 2 deletions src/Library/FullHealth.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
/// <summary>
/// Le quita cualquier estado negativo al Pokemon.
/// </summary>
/// <param name="pokemon">Pokemón a ser curado.</param>
/// <returns>El pokemon ya no tiene estado negativo.</returns>
/// <param name="pokemon">Pokemon a ser curado.</param>
/// <returns>El Pokemon ya no tiene estado negativo.</returns>
public string? Use(Pokemon? pokemon)

Check warning on line 19 in src/Library/FullHealth.cs

View workflow job for this annotation

GitHub Actions / build-test-generate-docs

Nullability of reference types in return type of 'string? FullHealth.Use(Pokemon? pokemon)' doesn't match implicitly implemented member 'string IItem.Use(Pokemon pokemon)' (possibly because of nullability attributes).
{
if (pokemon != null)
{
Expand Down
3 changes: 3 additions & 0 deletions src/Library/IAttack.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,8 @@ public interface IAttack
/// </summary>
public double Accuracy {get;}

/// <summary>
/// Genera una descripción del ataque.
/// </summary>
public string InfoAttack();
}
6 changes: 6 additions & 0 deletions src/Library/Pokemon.cs
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,9 @@

}

/// <summary>
/// Establece un número aleatorio entre 1 y 4 de turnos durante los cuales un Pokemon estará dormido.
/// </summary>
public void SetAsleepTurns()
{
Random random = new Random();
Expand Down Expand Up @@ -177,9 +180,12 @@

}
}
return null;

Check warning on line 183 in src/Library/Pokemon.cs

View workflow job for this annotation

GitHub Actions / build-test-generate-docs

Possible null reference return.
}

/// <summary>
/// Método abstracto para obtener una nueva instancia del Pokemon deseado.
/// </summary>
public abstract Pokemon Instance();

}
4 changes: 4 additions & 0 deletions src/Library/SpecialAttack.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,11 @@
Cooldown = 4;
}

/// <summary>
/// Genera una descripción formateada del ataque.
/// Incluye el nombre, tipo, precisión, potencia del ataque, efecto especial y cooldown.
/// </summary>
public string InfoAttack()

Check warning on line 56 in src/Library/SpecialAttack.cs

View workflow job for this annotation

GitHub Actions / build-test-generate-docs

'SpecialAttack.InfoAttack()' hides inherited member 'Attack.InfoAttack()'. Use the new keyword if hiding was intended.
{
return $"**{this.Name}**: tipo *{this.Type}*, precisión *{this.Accuracy*100}*, potencia *{this.Power}*, efecto especial *{this.SpecialEffect}*, cooldown de uso actual *{this.Cooldown}*\n";
}
Expand Down
Loading