Browse Source

Added cheats for testing

master
Macoy Madson 5 years ago
parent
commit
e1851d2462
  1. 1945
      7DRL2018.sublime-workspace
  2. 3
      TODO.tasks
  3. 3
      src/Abilities.cpp
  4. 2
      src/Enemies.cpp
  5. 2
      src/Game.hpp
  6. 58
      src/Gameplay.cpp
  7. 6
      src/Globals.hpp

1945
7DRL2018.sublime-workspace

File diff suppressed because it is too large

3
TODO.tasks

@ -30,6 +30,7 @@ Improve position description
Random spawn in cube doesn't work as expected
REMOVE ENTER CLOSES GAME!
Second restart lighting hitting caller no stairs appeared
@ -37,9 +38,11 @@ Second restart lighting hitting caller no stairs appeared
Show last screen on death
Doing
-------
NEXT: Add abilities!
Need some crowd control, stronger abilities for harder levels

3
src/Abilities.cpp

@ -46,6 +46,9 @@ bool Ability::IsCooldownDone()
int Ability::CooldownRemaining()
{
if (ActivatedOnTurn == -1)
return false;
return -(TurnCounter - (ActivatedOnTurn + CooldownTime)) + 1;
}

2
src/Enemies.cpp

@ -111,7 +111,7 @@ void Summoner::DoTurn()
if (gameState.currentLevel > LEVEL_NUM_FOREST)
{
// Add offset so they aren't spawned on same turn
if ((TurnCounter + 5) % spawnRate == 0 && NumSpawns < MAX_SINGLE_SUMMONS)
if ((TurnCounter + (rand() % 5)) % spawnRate == 0 && NumSpawns < MAX_SINGLE_SUMMONS)
{
NumSpawns++;
LightningWizard* newLightningWizard = new LightningWizard();

2
src/Game.hpp

@ -65,6 +65,8 @@ struct GameState
std::string levelName;
bool enableCheats;
// Remember to add fields to Reset Globals block!
};

58
src/Gameplay.cpp

@ -194,6 +194,9 @@ bool PlayGame()
gameState.player.Initialize();
gameState.abilitiesUpdatingFx.clear();
// TODO: Remove before ship!
gameState.enableCheats = true;
//
// Level initialization
//
@ -236,6 +239,61 @@ bool PlayGame()
// Input
//
// TODO: Reset before ship!
if (gameState.enableCheats)
{
// Set health to high number
if (gameInp.Tapped(inputCode::F1))
{
RLCombatStat& health = gameState.player.Stats["HP"];
health.Max = 10000;
health.Value = 10000;
LOGD << "Cheat: health up";
}
// Reset cooldowns
if (gameInp.Tapped(inputCode::F2))
{
for (Ability* ability : gameState.player.Abilities)
{
if (!ability)
continue;
ability->ActivatedOnTurn = -1;
}
LOGD << "Cheat: skip cooldowns";
}
// Next level
if (gameInp.Tapped(inputCode::F3))
{
LoadNextLevel();
TurnCounter++;
LOGI << "You step through to the next level";
LOGD << "Cheat: Next Level";
continue;
}
// Level up
if (gameInp.Tapped(inputCode::F4))
{
gameState.player.LevelUp();
LOGD << "Cheat: Level up";
}
// Randomize abilities
if (gameInp.Tapped(inputCode::F5))
{
int counter = 0;
for (Ability* ability : gameState.player.Abilities)
{
if (ability)
delete ability;
gameState.player.Abilities[counter] = getNewRandomAbility();
counter++;
}
LOGD << "Cheat: skip cooldowns";
}
}
// Return / Enter accepts target or closes the game
if (gameInp.Tapped(inputCode::Return))
{

6
src/Globals.hpp

@ -120,9 +120,9 @@
#define LEVEL_NUM_HELLSCAPE 10000
// Number of level enemies spawned = this * level
#define LEVELENEMY_SPAWN_NUM_MULTIPLIER_FOREST 3.f;
#define LEVELENEMY_SPAWN_NUM_MULTIPLIER_BARREN 2.f;
#define LEVELENEMY_SPAWN_NUM_MULTIPLIER_HELLSCAPE 1.2f;
#define LEVELENEMY_SPAWN_NUM_MULTIPLIER_FOREST 5.f;
#define LEVELENEMY_SPAWN_NUM_MULTIPLIER_BARREN 6.f;
#define LEVELENEMY_SPAWN_NUM_MULTIPLIER_HELLSCAPE 6.f;
//
// Only display once in log strings

Loading…
Cancel
Save