Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.
Sign upBasic health rewrite 1 #8390
Conversation
i2amroy
added some commits
Jul 31, 2014
This comment has been minimized.
This comment has been minimized.
|
I like the health affects healing idea. |
This comment has been minimized.
This comment has been minimized.
|
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
self-assigned this
Aug 1, 2014
KA101
reviewed
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.
This comment has been minimized.
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.
This comment has been minimized.
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.
This comment has been minimized.
KA101
reviewed
Aug 1, 2014
|
|
||
| // 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.
This comment has been minimized.
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.
This comment has been minimized.
i2amroy
Aug 2, 2014
Author
Member
The logic here was flawed previously. It used to work like this:
- If the player was hibernating and they were not hungry and not thirsty they would heal every 250 turns.
- 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:
- If the person is a hibernator and they are not hungry and not thirsty, they heal every 350 game turns.
- 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.
This comment has been minimized.
KA101
reviewed
Aug 1, 2014
| 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.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
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
removed their assignment
Aug 1, 2014
This comment has been minimized.
This comment has been minimized.
|
OK, I'm gonna ask for some answers before merging this. Sorry, i2amroy. |
i2amroy commentedJul 31, 2014
First chunk of the health rewrite. This PR: