Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Basic health rewrite 1 #8390

Merged
merged 7 commits into from Aug 3, 2014

Conversation

Projects
None yet
4 participants
@i2amroy
Copy link
Member

commented Jul 31, 2014

First chunk of the health rewrite. This PR:

  • Reworks the health system. The new system ranges from approximately -100 to 100, and updates on a 6 hour basis. Effects from food stack up a modifier on the next roll, which decreases greatly each time a roll is made, decaying to virtually nothing after the course of a day or so. As a result health is now a much better value of how healthy the player has been in the long term.
  • Health now affects how fast the player heals while sleeping, with it being able to provide up to a +/- 1 in 4 chance, (the same as the default heal chance). This means low health players may not heal at all, and high health ones may heal additionally fast. Also performed a slight rework on the healing system while asleep, which now can handle stacking chances for players to heal much better.
  • Made AEP_SICK artifacts have an effect again.
  • Many things that used to affect health directly now affect your health modifier instead.
  • Fixed a few small coding logic errors I stumbled upon.
  • Styled Player::mend()

i2amroy added some commits Jul 31, 2014

Merge to mainline
Conflicts:
	src/player.cpp
@Zireael07

This comment has been minimized.

Copy link
Contributor

commented Jul 31, 2014

I like the health affects healing idea.

@i2amroy

This comment has been minimized.

Copy link
Member Author

commented Jul 31, 2014

Hmmm, I seem to have a lua problem. Hopefully this latest thing will fix, because I have no idea how that stuff works right now.

@KA101 KA101 self-assigned this Aug 1, 2014

// Equivalent to X in 150000 + health * 1000
if (one_in(100) && x_in_y(dis.intensity, 150 + p.health)) {
// Equivalent to X in 150000 + health * 100
if (one_in(100) && x_in_y(dis.intensity, 150 + p.get_healthy() / 10)) {

This comment has been minimized.

Copy link
@KA101

KA101 Aug 1, 2014

Contributor

OK, so fungal infections are more likely. I recall their being rather difficult to get (I routinely had to strip and stand around in a Bloom for 15 min to get 'em), but you should make a point of mentioning these changes in future.

This comment has been minimized.

Copy link
@kevingranade

kevingranade Aug 1, 2014

Member

It looks like given the same scenario player::get_healthy() will return a number 10x as large as the previous player::health would have, so it's adjusting to keep the rate the same.

This comment has been minimized.

Copy link
@KA101

KA101 Aug 1, 2014

Contributor

Fair enough.


// If you hit Very Thirsty, you kick up into regular Sleep as a safety precaution.
// See above. No log note for you. :-/
if((int(calendar::turn) % 50 == 0) && (!(p.hunger < -60) || (p.thirst >= 80))) {
} else if(int(calendar::turn) % 50 == 0) {

This comment has been minimized.

Copy link
@KA101

KA101 Aug 1, 2014

Contributor

Reasoning? (I wrote this check because a double-cold during Hibernation nearly killed a test character, and folks shouldn't be permitted to be put into critical hunger/thirst thanks to a random fluke like that.)

This comment has been minimized.

Copy link
@i2amroy

i2amroy Aug 2, 2014

Author Member

The logic here was flawed previously. It used to work like this:

  1. If the player was hibernating and they were not hungry and not thirsty they would heal every 250 turns.
  2. If the player was hungry or they were not thirsty (due to a flipped sign on the second check) they would then heal every 50 turns, regardless of if they were hibernating or not.

This meant hibernators were healing faster than even normal people were. It also meant that people who were not hungry and thirsty wouldn't heal at all, regardless of how much they slept. Add on top of that that both blocks should never trigger together, and it cries out to use an if()/else if() rather then two separate if() blocks.

The new logic works like this:

  1. If the person is a hibernator and they are not hungry and not thirsty, they heal every 350 game turns.
  2. Else they heal every 50 game turns.

By switching to an if()/else if() it removes the broken logic, and automatically means that any hibernators who get hungry/thirsty will be automatically bumped up into normal sleep. There's no need to recheck hunger and thirst, since if they are a hibernator that falls to the else if block they will have already implicitly passed the tests that were previously present there.

This comment has been minimized.

Copy link
@KA101

KA101 Aug 2, 2014

Contributor

Wev.

if (p.fatigue <= 0 && p.fatigue > -20) {
p.fatigue = -25;
add_msg(m_good, _("You feel well rested."));
dis.duration = dice(3, 100);

This comment has been minimized.

Copy link
@KA101

KA101 Aug 1, 2014

Contributor

Why delete the fully-rested notification??

This comment has been minimized.

Copy link
@i2amroy

i2amroy Aug 2, 2014

Author Member

That appears to be a small merge mixup. I'll add that back in.

This comment has been minimized.

Copy link
@i2amroy

i2amroy Aug 2, 2014

Author Member

This is fixed, as you can see on the file changes tab, but the main page won't show it because it ended up on the other side of the "old" parenthesis.

@KA101 KA101 removed their assignment Aug 1, 2014

@KA101

This comment has been minimized.

Copy link
Contributor

commented Aug 1, 2014

OK, I'm gonna ask for some answers before merging this. Sorry, i2amroy.

@kevingranade kevingranade merged commit a26321f into CleverRaven:master Aug 3, 2014

1 check passed

default This has been rescheduled for testing as the 'master' branch has been updated.

@i2amroy i2amroy deleted the i2amroy:Health-new branch Aug 5, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.