-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
28 changed files
with
326 additions
and
106 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
namespace ClassLibrary | ||
{ | ||
public class CuraTotal : Item | ||
{ | ||
public CuraTotal() : base("Cura total") { } | ||
|
||
public override string ApplyEffect(Pokemon pokemon) | ||
{ | ||
if (pokemon == null) | ||
{ | ||
return "No hay un Pokémon activo para curar."; | ||
} | ||
|
||
pokemon.HealthPoints = 100; | ||
return $"{pokemon.Name} ha sido curado completamente."; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
namespace ClassLibrary; | ||
|
||
public class Item | ||
{ | ||
public string Name { get; } | ||
|
||
public Item(string name) | ||
{ | ||
this.Name = name; | ||
} | ||
/// <summary> | ||
/// Aplica el efecto del ítem en el Pokémon especificado. | ||
/// Este método será sobrescrito por las subclases. | ||
/// </summary> | ||
/// <param name="pokemon">El Pokémon al que se le aplicará el efecto.</param> | ||
/// <returns>Un mensaje con el resultado de aplicar el efecto.</returns> | ||
public virtual string ApplyEffect(Pokemon pokemon) | ||
{ | ||
return $"{Name} no tiene ningún efecto."; | ||
} | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
namespace ClassLibrary | ||
{ | ||
public class Revivir : Item | ||
{ | ||
private const int ReviveHealth = 50; | ||
|
||
public Revivir() : base("Revivir") { } | ||
|
||
public override string ApplyEffect(Pokemon pokemon) | ||
{ | ||
if (pokemon == null) | ||
{ | ||
return "No hay un Pokémon para revivir."; | ||
} | ||
|
||
if (pokemon.HealthPoints > 0) | ||
{ | ||
return $"{pokemon.Name} no puede ser revivido."; | ||
} | ||
|
||
pokemon.HealthPoints = ReviveHealth; | ||
return $"{pokemon.Name} ha sido revivido con {ReviveHealth} puntos de vida."; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
namespace ClassLibrary | ||
{ | ||
public class SuperPocion : Item | ||
{ | ||
private const int HealingAmount = 70; | ||
|
||
public SuperPocion() : base("Super pocion") { } | ||
|
||
public override string ApplyEffect(Pokemon pokemon) | ||
{ | ||
if (pokemon == null) | ||
{ | ||
return "No hay un Pokémon activo para curar."; | ||
} | ||
|
||
int previousHealth = pokemon.HealthPoints; | ||
pokemon.HealthPoints += HealingAmount; | ||
int healthRestored = pokemon.HealthPoints - previousHealth; | ||
|
||
return $"{pokemon.Name} ha recuperado {healthRestored} puntos de vida."; | ||
} | ||
} | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.