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): throwing weapons sanity-checking #5474

Open
wants to merge 33 commits into
base: main
Choose a base branch
from

Conversation

chaosvolt
Copy link
Member

@chaosvolt chaosvolt commented Sep 30, 2024

Checklist

Required

Optional

Purpose of change

followup of #5088.

After some work, finally got this working right. This follows up on #5088 by making it so guns that use the throwing skill will use either the damage/range you'd get from throwing the ammo, or the ammo's own bonuses, whichever is higher.

Describe the solution

C++ Changes:

  1. In character_functions.cpp, select_ammo uses either damage bonus from throwing weapons (see below) or the ammo's own damage when choosing what ammo to load into a sling, whichever is higher.
  2. In item.cpp, set item::gun_info to check how much you'd get out of throwing the ammo by hand displaying the damage of a weapon with the throwing skill, and item::gun_range likewise gets the throwing range of the ammo being tested when printing total range, using either in place of the ammo's specified damage/range bonus depending on which is higher. Also includes a UI note stating that the listed damage and range will vary for relevant weapons.
  3. In ranged.cpp and ranged.h, thanks to Scarf defined function throw_damage_projectile used to calculate how much damage throwing an item would deal. This is done so the same calcs can be used in ranged::fire_gun to use that damage for slings if needed, and in throw_item, without redundant functions.

JSON changes:

  1. Beefed up damage and range of slingshot cannons to stay competitive with staff sling for early-game characters who get the means to make one.
  2. Adjusted comments and description for slings with relevant info.

Describe alternatives you've considered

Screaming, main alternative that was here got implemented.

Testing

  1. Compiled and load-tested.
  2. Confirmed that select ammo menu showed rocks as having 9 damage instead of 7 (9 being expected thrown damage at zero throwing), while sling bullets still showed 16 damage (its ammo value being higher than its thrown damage).
  3. Confirmed slings show expected damage of 6+9 damage instead of 6+7.
  4. Buffed throwing to 10 and saw it showed 6+16 (22) damage now, and tested firing a sling at a debug monster to confirm average damage was indeed near 22.
  5. Re-tested with lead sling bullets at level zero throwing, confirmed it was using the sling bullet's damage via average damage being near 22 as expected.

image

Additional context

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

autofix-ci bot commented Sep 30, 2024

Autofix has formatted code style violation in this PR.

I edit commits locally (e.g: git, github desktop) and want to keep autofix
  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.

@chaosvolt
Copy link
Member Author

So, throwing rocks at 12 in stats and 10 throwing skill deals about 12 damage prior to this change, and about 19 with the change. I'm trying to figure out where I bungled the math in the process of writing this.

@chaosvolt
Copy link
Member Author

Oh no. This is with 8 in all stats and zero skills.
image

So all those fixes have since made the math even more wrong that they were before, this used to be 6+16.

@chaosvolt
Copy link
Member Author

Okay, tests pass after giving it a second look, and new testing done:

In build 2024-09-30:
* Rock, no skill, 8 in stats: Throwing range 16 tiles, damage 8-10.
* Rock, 10 skills, 12 in stats: Throwing range 24 tiles, damage 15-17.
* Iron javelin, no skill, 8 in stats: Throwing range 7 tiles, damage 23-26.
* Iron javelin, 10 skills, 12 in stats: Throwing range 11 tiles, damage 36-43.
Current damage ranges seen, tested by tossing at a debug monster:
* Rock, no skill, 8 in stats: Throwing range 16 tiles, damage 8-10.
* Rock, 10 skills, 12 in stats: Throwing range 24 tiles, damage 15-17.
* Iron javelin, no skill, 8 in stats: Throwing range 7 tiles, damage 23-27.
* Iron javelin, 10 skills, 12 in stats: Throwing range 11 tiles, damage 36-43.
Sling claims the throwing damage bonus is actually:
* No skill, 8 in stats: 24 (16 expected)
* 10 skills, 12 in stats: 30 (23 expected)

So it seems Scarf did succeed in fixing the damage values, it's just the UI is displaying them very wrongly for some reason.

How was it that simple this whole fucking time aaaaa
@github-actions github-actions bot added the JSON related to game datas in JSON format. label Oct 27, 2024
@chaosvolt
Copy link
Member Author

chaosvolt commented Oct 27, 2024

New oddity: a fresh shelter baby character shows a throwing range of 8 with pebbles, and the sling gives +8, but pebbles out of a sling have 26 range. o.O

EDIT: Disregard, I forgot the ammo itself comes with +10 range, duh.

@chaosvolt chaosvolt marked this pull request as ready for review October 27, 2024 02:34
@scarf005 scarf005 requested review from Coolthulhu and removed request for scarf005 November 4, 2024 13:38
@chaosvolt
Copy link
Member Author

Okay, it now uses either the ammo's specified damage/range OR the value you'd get out of throwing the ammo, whichever is higher, instead of getting both. :>

@scarf005
Copy link
Member

Okay, it now uses either the ammo's specified damage/range OR the value you'd get out of throwing the ammo, whichever is higher, instead of getting both. :>

maybe we should change to show both thrown and used-as-ammo damage? (e.g rocks can be both thrown/used in sling)

@chaosvolt
Copy link
Member Author

Hmm, maybe? That might need to be applied to a lot of stuff actually, since non-ammo items like throwing knives would also benefit from it...

@chaosvolt
Copy link
Member Author

UGH. Fucking teeesssts.

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