Skip to content

Conversation

@majochem
Copy link
Contributor

@majochem majochem commented Feb 21, 2025

Reverting back to draft for now, as I was not aware that attack speed should affect reload speed as well

Fixes #221 .

Description of the problem being solved:

This adds support for several currently unsupported mechanics for Crossbows:

  • 1. Reload rate calculated based on Reload time and effective bolt count
  • 2. Effective bolt count calculated, based on chance not to consume a crossbow bolt
  • 3. Reload time factored into attack rate --> additional bolts and reload speed affect DPS
  • 4. Mana cost per second based on reload rate
  • 5. Effect of additional projectiles (like Scattershot support) on Crossbow skills that use barrage / sequential projectile behaviour
  • 6. Enable standard DPS calculation for Crossbow skills that were internally marked as "display average instead of DPS" in the game files (e.g. Explosive Shot & High Velocity Rounds)
  • 7. Calculate average number of reloaded bolts (for Fresh Clip support)
  • 8. Add config option to override number of reloaded bolts
  • 9. Parse reload speed from Crossbow item bases
  • 10. Make increases to attack speed apply to reload times

Limitations:

  • Projectile barrage behavior (multi hit) does not yet appear to affect ailment application (chance and roll ranges), but it does affect things like "gain on hit" effects.
  • Interactions with added cooldowns (e.g. Hourglass Support) not fully considered/tested
  • Interactions with forms of added "SkillAttackTime" (e.g. Plasma Blast) not fully tested (see below)
  • Breakdowns do not fully show the effect of modifications to "SkillAttackTime" yet. However, this is also true for non-Crossbow skills, like Sunder and therefore not really in scope for this PR
  • Rapid Shot's Heat buildup and charge mechanic not supported yet

Steps taken to verify a working solution:

  • Base reload time correctly captured from item base
  • "INC" and "MORE" modifiers from gems and passive tree apply correctly
  • Bolt count correctly affects effective attack rate and effective reload rate
  • Attack & Skill speed modifiers interact correctly
  • "Chance to not consume a bolt" correctly affects effective bolt count and all related stats. >100% chance is also supported
  • Mana cost is calculated proportionally to effective reload speed
  • Additional projectiles affect DPS and related stats only if Skill has the crossbow barrage property
  • Additional projectiles correctly add to attack time, based on the "ratio" saved on the gem (or 100% if no ratio is defined)
  • Breakdowns show correct stats and only appear if relevant
  • Config option for "bolts reloaded in past 6 seconds only appears if "Fresh Clip" is active on a skill
  • Value for avg. reloaded bolts gets calculated correctly and applies correct damage increase (also if defined differently in config)

Link to a build that showcases this PR:

Test Build

After screenshot:

Display stats and breakdown
image

Scattershot effect
{A6141884-F170-475C-975C-DFCF453C470D}

Fresh Clip Effect
{F2A4EA3A-E1B8-43EF-8787-9B755CDE410E}

@ViniciusKrau
Copy link

Life saver!

["Blackfire Crossbow"] = 0.85,
["Piercing Crossbow"] = 0.85,
["Cumbrous Crossbow"] = 0.9,
["Dedalian Crossbow"] = 0.85,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Spellcheck doesn't like the word "Dedalian", but that is exactly how it's spelled in game as well

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't figured out how to properly export and parse the "Reload Time" data from the item bases in the .ggpk file yet, but I am gonna be on vacation for three weeks. So, I implemented this workaround for now to at least get a working version that can be tested/reviewed. Obviously only meant as a temporary solution and will be easy to change once the data is there.

@majochem majochem changed the title Add support for various Crossbow mechanics (Reload Time, Additional Projectiles, Bolt Count, Mana costs) [WIP] Add support for various Crossbow mechanics (Reload Time, Additional Projectiles, Bolt Count, Mana costs, Fresh Clip) Feb 27, 2025
@majochem majochem changed the title Add support for various Crossbow mechanics (Reload Time, Additional Projectiles, Bolt Count, Mana costs, Fresh Clip) Add support for various Crossbow mechanics (Reload Time, Additional Projectiles, Bolt Count, Mana costs) Feb 28, 2025
@majochem majochem changed the title Add support for various Crossbow mechanics (Reload Time, Additional Projectiles, Bolt Count, Mana costs) Add support for various Crossbow mechanics (Reload Time, Additional Projectiles, Bolt Count, Mana costs, Fresh Clip Support)) Feb 28, 2025
@majochem majochem marked this pull request as ready for review February 28, 2025 10:00
@Blitz54
Copy link
Contributor

Blitz54 commented Mar 3, 2025

out:write('Range = ', weaponType.Range, ', ')
out:write('},\n')

		if weaponType.ReloadTime > 0 then
			out:write('ReloadTime = ', round( weaponType.ReloadTime / 1000, 2 ), ', ')
		end

Adding this here just below Range will export the reload time. Don't think it matters where exactly, I just put it after range because it's the last column in the exporter.

@Blitz54 Blitz54 added the enhancement New feature, calculation, or mod label Mar 21, 2025
@majochem
Copy link
Contributor Author

out:write('Range = ', weaponType.Range, ', ')
out:write('},\n')

		if weaponType.ReloadTime > 0 then
			out:write('ReloadTime = ', round( weaponType.ReloadTime / 1000, 2 ), ', ')
		end

Adding this here just below Range will export the reload time. Don't think it matters where exactly, I just put it after range because it's the last column in the exporter.

Thanks! I ended up having to do a bit more than just that, but it definitely helped me to find the right starting point.
Code is now working with properly exported item base values and even supports local Reload Speed mods (although that mode technically currently only exists on one Unique).

image

@majochem majochem marked this pull request as draft April 5, 2025 08:56
@LocalIdentity LocalIdentity marked this pull request as ready for review April 6, 2025 04:34
@LocalIdentity LocalIdentity merged commit 52b8252 into PathOfBuildingCommunity:dev Apr 6, 2025
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature, calculation, or mod

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Configuration option for "Reloaded Recently" (Fresh Clip support)

4 participants