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

feat(balance): rework how ranged bash data checks destroy_threshold #4223

Merged

Conversation

chaosvolt
Copy link
Member

@chaosvolt chaosvolt commented Feb 11, 2024

Purpose of change

This implements an idea I mentioned in #4222 that will enable support for terrain being wrecked by shots that don't penetrate.

Set aside as WIP since I'm doing this from my laptop, plus I will want to wait until the other two PRs are merged since I'll likely need to do some final audits of destroy thresholds for some items.

Describe the solution

C++ changes:

  1. In map.cpp, updated map::shoot so that the checks for ranged bash info set aside the incoming damage value as a number randomly multiplied by a value of 0.9 to 1.1, the same damage randomization that standard hits deal to creatures. This value is then checked against destroy_threshold instead of damage, so damage threshold now checks the value of incoming damage (with some RNG) prior to damage reduction.
  2. In addition, map::shoot now properly tracks armor penetration separately from raw damage, and takes armor multiplier into account. reduction values for ranged bashed info are reduced by the bullet's arpen, then modified by any armor mult, before being applied to incoming damage.
  3. Updated the description of what destroy_threshold does in mapdata.h accordingly.

JSON changes:

  1. Sandbags and earthbags beefed up just enough to ensure they aren't too easily wrecked by shotshells, while being just in the range for .50 BMG to have even odds of wrecking.
  2. Finally standardized bash values and ranged bash info of reinforced, laminated, and ballistic glass to make sense. Also rigged consistent bash values so that rifles tend to have even odds of breaking laminated glass, shotshells stand good odds against reinforced glass, while ballistic glass tends to require .50 BMG. This also at last makes the door and wall versions of each glass type properly consistent with each other.

Describe alternatives you've considered

Rigging some case-by-case basis hackery allowing some ranged bash data to roll before damage reduction is considered and some to check after damage reduction.

Testing

  1. Checked affected JSON for syntax and lint errors.
  2. Compiled and load-tested.
  3. Spawned in and confirmed that plain 00 shot now sometimes destroys a wooden door and sometimes doesn't, instead of never doing so.
  4. Blasted ballistic glass with said shotgun, it correctly failed to deal damage through it due to buckshot's armor multiplier, and didn't bust the glass.
  5. Repeated against laminated glass, also negates the penetration but is capable of sometimes being shattered by buckshot.
  6. Blasted a sandbag barricade with a .50 cal, it still punches through with comparable damage, now sometimes wrecks the barricade.

Initially ran into #4236 along the way but testing confirmed it happens in build 2024-02-18 too. Repeated test after grabbing the fix for it and no crashes.

Additional context

Checklist

@github-actions github-actions bot added the src changes related to source code. label Feb 11, 2024
Copy link
Contributor

autofix-ci bot commented Feb 11, 2024

The Autofix app has found code style violation and automatically formatted this Pull Request.

I locally edit my commits (e.g: git, github desktop)

Please choose following options:

I'd like to accept the automated commit
  1. Run git pull. this will merge the automated commit into your local copy of the PR branch.
  2. Continue working.
I do not want the automated commit
  1. Format your code locally, then commit it.
  2. Run git push --force to force push your branch. This will overwrite the automated commit on remote with your local one.
  3. Continue working.

If you don't do this, your following commits will be based on the old commit, and cause MERGE CONFLICT.

This PR is complete and I don't want to edit it anymore

It's safe to ignore this message.

I edit this PR through web UI

You can ignore this message and continue working.

I have no idea what this message is talking about

You can ignore this message and continue working. If you find any problem, please ask for help and ping @scarf005.

@github-actions github-actions bot added the JSON related to game datas in JSON format. label Feb 19, 2024
@chaosvolt chaosvolt marked this pull request as ready for review February 20, 2024 01:57
@chaosvolt chaosvolt merged commit d7e779b into cataclysmbnteam:main Feb 22, 2024
18 checks passed
@chaosvolt chaosvolt deleted the ranged-bash-destroy-adjustment branch February 22, 2024 01:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
JSON related to game datas in JSON format. src changes related to source code.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants