Skip to content

Commit

Permalink
Modified balance, fixed small issues
Browse files Browse the repository at this point in the history
Modified some balance issues, changed land fish to restore more stamina, sea fish restore 20% of your stamina as opposed to just 20 stamina, enemies now level up stats more gradually, xp rates changed and xp needed reduced. Fixed issue with xp where only currently held fish counted towards xp, enemies weren't being registered, and xp would end up resetting as well,
  • Loading branch information
DesDel committed Mar 4, 2022
1 parent d6dd94f commit f3526da
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
6 changes: 3 additions & 3 deletions can-you-survive/Enemy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
//Constructor
Enemy::Enemy(Vector2f position)
{
health = 100;
maxHealth = 100;
health = 75;
maxHealth = 75;
level = 1;
m_damage = 2;
speed = 128;
Expand Down Expand Up @@ -362,7 +362,7 @@ void Enemy::MoveTowards(float elapsedTime, float totalTime, Vector2f pPosition)

void Enemy::LevelUp() {
level++;
float multi = pow(1.08, level);
float multi = 1.05;
health = maxHealth * multi;
maxHealth = maxHealth * multi;
m_damage = m_damage * multi;
Expand Down
2 changes: 1 addition & 1 deletion can-you-survive/Input.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ void Engine::input()
}
else
{
pPlayer->addXP(90 * year);
pPlayer->addXP(50 + (10 * year));
}
}
}
Expand Down
14 changes: 9 additions & 5 deletions can-you-survive/Player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -260,14 +260,17 @@ void Player::StaminaDecrease(float reduce)
{
//Reduce stamina a certain amount
stamina = stamina - reduce;
if (stamina < 0) {
stamina = 0;
}
}

//Restore health and stamina when player hibernates, fish consumed and used
void Player::Hibernate()
{
stamina = maxStamina;
health = maxHealth;
xp = fishNum * 10;
xp = xp + (fishNum * 10);
fishNum = 0;
}
//Check if the player has gained enough xp to level up.
Expand All @@ -279,8 +282,9 @@ void Player::CheckIfLevelUp()
maxStamina = maxStamina * 1.05;
health = maxHealth;
stamina = maxStamina;
m_damage++;
xpNeed = xpNeed * 2;
m_damage = m_damage ;
xp = xp - xpNeed;
xpNeed = xpNeed * 1.3;
//Check level up again incase another level up condition is already met
CheckIfLevelUp();
}
Expand Down Expand Up @@ -339,13 +343,13 @@ void Player::Pickup(std::string name)
if (name == "land")
{
//Stamina restoration is based on maximum stamina, the higher the max, the more stamina restored
stamina = stamina + maxStamina / 10;
stamina = stamina + maxStamina / 5;
//If stamina restoration increases it to more than the max, set stamina to max
if (stamina >= maxStamina)
{
stamina = maxStamina;
}
xp = xp + 10;

}
//Sea fish are stored for later use
else if (name == "sea")
Expand Down

0 comments on commit f3526da

Please sign in to comment.