Skip to content

Commit

Permalink
Finalizacion de test4 y arreglos en uml
Browse files Browse the repository at this point in the history
  • Loading branch information
SebastianCuneo committed Nov 8, 2024
1 parent 669bd3b commit f5c884e
Show file tree
Hide file tree
Showing 6 changed files with 67 additions and 319 deletions.
15 changes: 2 additions & 13 deletions docs/UML Proyecto Pokemon.drawio
Original file line number Diff line number Diff line change
Expand Up @@ -93,21 +93,10 @@
<mxCell id="sCWM8UpPIPFwUfGazDlC-3" value="" style="line;strokeWidth=1;fillColor=none;align=left;verticalAlign=middle;spacingTop=-1;spacingLeft=3;spacingRight=3;rotatable=0;labelPosition=right;points=[];portConstraint=eastwest;strokeColor=inherit;" parent="sCWM8UpPIPFwUfGazDlC-1" vertex="1">
<mxGeometry y="90" width="240" height="8" as="geometry" />
</mxCell>
<<<<<<< Updated upstream

<mxCell id="sCWM8UpPIPFwUfGazDlC-4" value="+ CheckIfGameEnds" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" parent="sCWM8UpPIPFwUfGazDlC-1" vertex="1">
<mxGeometry y="98" width="240" height="26" as="geometry" />
=======
<mxCell id="sCWM8UpPIPFwUfGazDlC-4" value="+ method(type): type" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" parent="sCWM8UpPIPFwUfGazDlC-1" vertex="1">
<mxGeometry y="60" width="160" height="26" as="geometry" />
</mxCell>
<mxCell id="sCWM8UpPIPFwUfGazDlC-8" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=1;entryY=0.175;entryDx=0;entryDy=0;entryPerimeter=0;" parent="1" source="pl-9-NFehJo8dU9QtRn4-5" target="rGXJMdR33EM9oFi3KllI-1" edge="1">
<mxGeometry relative="1" as="geometry">
<Array as="points">
<mxPoint x="340" y="-560" />
<mxPoint x="340" y="-1000" />
</Array>
</mxGeometry>
>>>>>>> Stashed changes

</mxCell>
<mxCell id="rGXJMdR33EM9oFi3KllI-44" value="PokemonCatalogBuilder" style="swimlane;fontStyle=1;align=center;verticalAlign=top;childLayout=stackLayout;horizontal=1;startSize=30;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=1;marginBottom=0;whiteSpace=wrap;html=1;" parent="1" vertex="1">
<mxGeometry x="-170" y="-800" width="220" height="130" as="geometry" />
Expand Down
39 changes: 21 additions & 18 deletions src/Library/Domain/Domain/Facade.cs
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ public void ChoosePokemonAndMoveToAttack(string playerDisplayName, string moveNa
throw new Exception($"El movimiento {moveName} no está disponible para el Pokémon {pokemonName}");
}

//player.ActivateMoveInActivePokemon(moveIndex);
player.ActivateMoveInActivePokemon(moveIndex);
}

//HISTORIA DE USUARIO 3
Expand Down Expand Up @@ -245,30 +245,35 @@ public string PlayerAttack(string attackerName, string defenderName, string move
// Verificar si el ataque es efectivo aleatorio con random
//Enviar mensaje interfaz de que no es efectivo y sino seguir

//double AccuaracyAttack = attackingPokemon.SpecialMoveNormal.Accuracy;

//if (AccuaracyAttack < 0.5)
double AccuaracyAttack = attacker.ActiveMove.Accuracy;

if (AccuaracyAttack < 0.5)
{
// return UserInterface.ShowMessageLowEffectiveness(AccuaracyAttack);
return UserInterface.ShowMessageLowEffectiveness(AccuaracyAttack);
}
// if (AccuaracyAttack > 0.5)
// {
// return UserInterface.ShowMessageHighEffectiveness(AccuaracyAttack);
// }


//golpecritico
Random random = new Random();

// Generar un número aleatorio entre 1 y 100
int randomNumber = random.Next(1, 101);
bool criticalHit = randomNumber <= 10;
double criticalHit;
if (randomNumber <= 10)
{
criticalHit = 1.20;
}
else
{
criticalHit = 1.0;
}

//Comprobar si es un golpe crítico.
//Un golpe crítico aumenta un 20% el daño a realizar. La probabilidad de que un golpe sea crítico es del 10%.
//Para eso definir de default 1


//Ejecuta el ataque
//attacker.ActiveMove.ExecuteMove(attacker, defender, criticalHit);

attacker.ExecuteMove(defender, criticalHit);

// Ejecuta el efecto de los ataques especiales que reducen el HP por turno
Expand All @@ -281,15 +286,13 @@ public string PlayerAttack(string attackerName, string defenderName, string move
{
attackingPokemon.HealthPoints -= (int) 0.10 * (attackingPokemon.HealthPoints);
}

//Implemetar el turno

//Penalizar el turno del jugador
Game game = GameList.FindGameByPlayerDisplayName(attackerName);
game.Turn.PenalizeTurn(attacker);

// Construye el mensaje de resultado
return UserInterface.ShowMessageAttackOcurred(attackingPokemon, defendingPokemon, attacker, defender);

//Penalizar el turno del jugador
// Game game = GameList.FindGameByPlayerDisplayName(playerDisplayName);
// game.Turn.PenalizeTurn(player);

}

Expand Down
2 changes: 1 addition & 1 deletion src/Library/Domain/Domain/Player.cs
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ public int GetIndexOfMoveInActivePokemon(string moveDisplayName)
/// <param name="index">Índice del movimiento en la lista de movimientos del Pokémon activo.</param>
public void ActivateMoveInActivePokemon(int index)
{
//this.ActiveMove = this.ActivePokemon.Moves[index];
this.ActiveMove = this.ActivePokemon.Moves[index];
}

public Item UseItem(string itemName)
Expand Down
8 changes: 4 additions & 4 deletions src/Library/Domain/Domain/UserInterface.cs
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ public static string ShowMessageCurrentTurnPlayer(string currentPlayerDisplayNam
/// <returns>Un mensaje formateado indicando que el ataque ocurrió.</returns>
public static string ShowMessageAttackOcurred(Pokemon attackingPokemon, Pokemon defendingPokemon, Player attacker, Player defender)
{
return $" Jugador {attacker.DisplayName} usa al Pokémon {attackingPokemon.Name} que ataca con {attacker.ActiveMove.Name} a {defendingPokemon} de {defender}";
return $"Jugador {attacker.DisplayName} usa al Pokémon {attackingPokemon.Name} que ataca con {attacker.ActiveMove.Name} a {defendingPokemon.Name} de {defender.DisplayName}";
}

/// <summary>
Expand All @@ -182,7 +182,7 @@ public static string ShowMessageAttackOcurred(Pokemon attackingPokemon, Pokemon
/// <returns>Un mensaje formateado indicando que el ataque no ocurrió debido a un movimiento especial activo.</returns>
public static string ShowMessageAttackDidNotOccur(Player attacker, Pokemon attackingPokemon)
{
return $"$ El jugador {attacker} no puede jugar porque su Pokémon {attackingPokemon} tiene un ataque especial activo que no lo permite";
return $"El jugador {attacker} no puede jugar porque su Pokémon {attackingPokemon} tiene un ataque especial activo que no lo permite";
}

/// <summary>
Expand All @@ -193,7 +193,7 @@ public static string ShowMessageAttackDidNotOccur(Player attacker, Pokemon attac
/// <returns>Un mensaje formateado indicando la efectividad.</returns>
public static String ShowMessageHighEffectiveness(Double accuaracyAttack)

Check warning on line 194 in src/Library/Domain/Domain/UserInterface.cs

View workflow job for this annotation

GitHub Actions / build-test-generate-docs

Parameter 'accuaracyAttack' has no matching param tag in the XML comment for 'UserInterface.ShowMessageHighEffectiveness(double)' (but other parameters do)
{
return $"$ La efectividad del ataque es alta: {accuaracyAttack} ";
return $"La efectividad del ataque es alta: {accuaracyAttack}";
}

/// <summary>
Expand All @@ -204,7 +204,7 @@ public static String ShowMessageHighEffectiveness(Double accuaracyAttack)
/// <returns>Un mensaje formateado indicando la efectividad.</returns>
public static String ShowMessageLowEffectiveness(Double accuaracyAttack)
{
return $"$ La efectividad del ataque es baja: {accuaracyAttack} ";
return $"La efectividad del ataque es baja: {accuaracyAttack}";
}

}
Expand Down
Loading

0 comments on commit f5c884e

Please sign in to comment.