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

Limbs: Apply crawling score to prone movement cost #54194

Merged
merged 3 commits into from
Jan 12, 2022

Conversation

dseguin
Copy link
Member

@dseguin dseguin commented Jan 9, 2022

Summary

None

Purpose of change

Fixes #54032.
Movement cost modifiers rely on having legs, even while prone. This means that characters without legs suffer maximum movement penalties even with perfectly functional arms.

Describe the solution

Add a crawling score and character modifier to determine movement cost while prone.

I'm far from an expert here, so hopefully someone can correct me on this. I've set the ability to crawl to be determined by:

  • Arms (60% - 30% each arm)
  • Legs (40% - 20% each leg)

When the character is prone, crawl_speed_movecost_mod applies to Character::run_cost instead of the regular run cost modifier. If the character is downed (not just prone), the crawl modifier is stacked on top of the regular move cost (instead of a flat x3 multiplier).

Describe alternatives you've considered

The values and modifiers are up in the air as far as accuracy goes. Thankfully those are easy to tweak. (again, I'm no expert)

Testing

Added unit tests to confirm the prone move costs below:

Encumbrance No limb damage Damaged arm (10 hp) 2 broken legs
None 600 moves 802 moves 1000 moves
30 (left arm) 660 moves 818 moves 1179 moves
37 (full body) 932 moves 1245 moves 1561 moves

Manual testing

At normal health, unencumbered (~6 seconds to move 1 tile):

crawlscore_normal
prone_normal

With 43 arm encumbrance (~8 seconds to move 1 tile):

crawlscore_encumb
prone_encumb

With a heavily damaged arm, unencumbered (~10 seconds to move 1 tile):

crawlscore_hurt
prone_hurt

With a heavily damaged arm and 43 arm encumbrance (~12 seconds to move 1 tile):

crawlscore_hurt_encumb
prone_hurt_encumb

At normal health, but with 2 broken legs (~10 seconds to move 1 tile):

prone_nolegs

Additional context

I mostly just wanted to demonstrate the jsonified scores/modifiers from #53069 :P

Ping: @Venera3. Do you have any thoughts about this?

@github-actions github-actions bot added astyled astyled PR, label is assigned by github actions json-styled JSON lint passed, label assigned by github actions labels Jan 9, 2022
@Maleclypse Maleclypse added <Bugfix> This is a fix for a bug (or closes open issue) Mechanics: Character / Player Character / Player mechanics labels Jan 9, 2022
@Venera3
Copy link
Member

Venera3 commented Jan 9, 2022

Nice! I'd raise the legs' contribution a bit, but in the game's context this distribution might work better. The one weirdness I can see is if hands/feet contribute you can't be immobilized barring encumbrance - minor parts don't have HP, so HP-scaled scores are kept at 100% even if the main part is broken. I haven't really decided how to deal with that in general, though.

@dseguin
Copy link
Member Author

dseguin commented Jan 9, 2022

Good point! I'll leave hands and feet out of it for now.

@github-actions github-actions bot removed the astyled astyled PR, label is assigned by github actions label Jan 11, 2022
@github-actions github-actions bot added astyled astyled PR, label is assigned by github actions BasicBuildPassed This PR builds correctly, label assigned by github actions labels Jan 11, 2022
@dseguin dseguin marked this pull request as ready for review January 12, 2022 04:37
@kevingranade kevingranade merged commit 67ba4fe into CleverRaven:master Jan 12, 2022
@dseguin dseguin deleted the crawl_score branch January 12, 2022 20:38
@Holli-Git
Copy link
Contributor

Wow I did not expect my issue to get fixed so quickly! Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
astyled astyled PR, label is assigned by github actions BasicBuildPassed This PR builds correctly, label assigned by github actions <Bugfix> This is a fix for a bug (or closes open issue) json-styled JSON lint passed, label assigned by github actions Mechanics: Character / Player Character / Player mechanics
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Moving with two broken legs takes too long
5 participants