Skip to content
This repository has been archived by the owner on May 5, 2022. It is now read-only.

Redesigned/fixed enhanced health #5

Merged
merged 3 commits into from
Jul 26, 2021
Merged

Conversation

potatoes1286
Copy link
Collaborator

No description provided.

Comment on lines +17 to +19
private float RegenToGo;
private float currentRegenDelayLength;
private float healthMonitor;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use _hungarianNotation for private fields, private properties should use CamelCase

Comment on lines +50 to 74
private void RegenerationHandler()
{
//if player is below RegenCap
if (_hadesSystem.Player.GetPlayerHealth() <
HADESConfig.EnhancedHealth.RegenCap * _hadesSystem.Player.GetMaxHealthPlayerRaw())
{
//The health before healing
float curHealth = CurrentHealth;
Logging.Debug.Print($"Current health {curHealth}\nInit health {initHealth}");
//If the player was damaged (The current health before healing is less than the health before starting regeneration),
//then restart the loop with the cooldown
if (curHealth < initHealth) goto regen;
//TODO: make the player heal in n intervals until the regen cap is reached
Player.HealPercent(i);
//if the delay time's up
if(currentRegenDelayLength >= HADESConfig.EnhancedHealth.RegenDelay * 50)
{
//if the player's hp is lower than what it was, assume damage taken, lower hp
if (_hadesSystem.Player.GetPlayerHealth() < healthMonitor)
{
currentRegenDelayLength = 0;
}

//go add player hp
_hadesSystem.Player.HealPercent(HADESConfig.EnhancedHealth.RegenSpeed * 0.02f);
} else currentRegenDelayLength++; //count down (up?) if the delay time is not finished
}

Logging.Debug.Print("Done Regeneration");
else
{
currentRegenDelayLength = 0;
}
healthMonitor = _hadesSystem.Player.GetPlayerHealth();
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Put into FixedUpdate()

Copy link
Collaborator

@Frityet Frityet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Naming and brevity

@Frityet Frityet merged commit 6864b1e into WFIOST:master Jul 26, 2021
@Frityet
Copy link
Collaborator

Frityet commented Jul 26, 2021

im really bored so ill fix it myself

@Frityet Frityet linked an issue Jul 26, 2021 that may be closed by this pull request
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Regeneration
2 participants