Colocados los disparadores de los logros en su sitio

This commit is contained in:
2022-12-29 14:08:42 +01:00
parent f590101047
commit c0d4eddde7
7 changed files with 117 additions and 9 deletions

View File

@@ -467,6 +467,9 @@ void Game::killPlayer()
// Actualiza las estadisticas
stats->addDeath(room->getName());
// Invalida el logro de pasarse el juego sin morir
cheevos->invalidate(11);
// Destruye la habitacion y el jugador
delete room;
delete this->player;
@@ -583,6 +586,9 @@ bool Game::checkEndGame()
if (haveTheItems && isOnTheRoom && isOnTheDoor)
{
// Comprueba los logros de completar el juego
checkEndGameCheevos();
section->name = SECTION_PROG_ENDING;
return true;
}
@@ -655,6 +661,14 @@ void Game::checkRestoringJail()
board.lives++;
JA_PlaySound(deathSound);
}
// Invalida el logro de completar el juego sin entrar a la jail
const bool haveTheItems = board.items >= int(totalItems * 0.9f) || options->cheat.jailEnabled; // Con mas del 90% de los items recogidos
if (!haveTheItems)
{
cheevos->invalidate(9);
}
}
// Inicializa el diccionario de las estadísticas
@@ -692,8 +706,69 @@ void Game::fillRoomNameTexture()
// Comprueba algunos logros
void Game::checkSomeCheevos()
{
if (board.items == 1)
// Logros sobre la cantidad de items
if (board.items == totalItems)
{
cheevos->unlockCheevo(2);
cheevos->unlock(4);
cheevos->unlock(3);
cheevos->unlock(2);
cheevos->unlock(1);
}
else if (board.items >= totalItems * 0.75f)
{
cheevos->unlock(3);
cheevos->unlock(2);
cheevos->unlock(1);
}
else if (board.items >= totalItems * 0.5f)
{
cheevos->unlock(2);
cheevos->unlock(1);
}
else if (board.items >= totalItems * 0.25f)
{
cheevos->unlock(1);
}
// Logros sobre las habitaciones visitadas
if (board.rooms >= 60)
{
cheevos->unlock(7);
cheevos->unlock(6);
cheevos->unlock(5);
}
else if (board.rooms >= 40)
{
cheevos->unlock(6);
cheevos->unlock(5);
}
else if (board.rooms >= 20)
{
cheevos->unlock(5);
}
}
// Comprueba los logros de completar el juego
void Game::checkEndGameCheevos()
{
// "Complete the game"
cheevos->unlock(8);
// "Complete the game without entering the jail"
cheevos->unlock(9);
// "Complete the game with all items"
if (board.items == totalItems)
{
cheevos->unlock(10);
}
// "Complete the game without dying"
cheevos->unlock(11);
// "Complete the game in under 30 minutes"
if (scoreboard->getMinutes() < 30)
{
cheevos->unlock(12);
}
}