Repository navigation
Conversation
The client's stat list carries the passive stats of Two Hand Mastery
(crushing blow, crushing blow efficiency), Javelin and Spear Mastery
(critical strike multiplier) and Throwing Mastery (pierce) whatever
weapon is equipped. GetMasteryStat only took the pierce bonus back out
when the weapon does not match, and the pierce call itself was commented
out, so the panel showed e.g. 2HM crushing blow with a one-handed axe or
unarmed, the JSM multiplier with a bow, and Throwing Mastery pierce with
any weapon. Remove all four when the weapon does not match the
mastery's passive item type, and use the pierce correction again.
Claw and Dagger Mastery's critical strike was only counted when the
right skill's item type is hand-to-hand (Dragon Claw, Weapon Block).
Attack ("weap") and PD2's claw skills ("asm": Tiger Strike, Fists of
Fire, ...) never matched, so it was missing for nearly every skill.
Count it for melee weapon skills, like One Hand Mastery, and for "asm"
skills.
The game clamps a player's poison length reduction, after the difficulty penalty, to -100..75 (Hell: 175% reduction reaches the 75% cap), so poison lasts between 25% and 200% of its base length. The panel printed 100 - penalty - reduction unclamped, e.g. 0% for 100% reduction in Normal or -25% for 225% in Hell. Apply the same clamp.
errolgr
marked this pull request as ready for review
October 5, 2026 01:57
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes four rows in the advanced stats panel that showed wrong values:
Length: 0%./in orange; the other resist rows draw it in white.Problem
Masteries. On the server, a passive mastery stat sits on the mastery's item-type layer (
passiveitypein Skills.txt), so it only counts with a matching weapon. The client's stat list has the same stats at layer 0 whatever is equipped. In game, with a hand axe, large axe, javelin or no weapon,GetUnitStat(…, 0)always returned item_crushingblow 29, skill_pierce 41 and item_crit_multiplier 29 at mastery level 20.GetMasteryStatis meant to take a non-matching mastery's bonus back out, but its fallback branch only did that for pierce, and the pierce call inStatsDisplay.cppwas commented out. (c795e3f changed the fallback from "always subtract" to "pierce only"; the client data above shows crushing blow, efficiency and the crit multiplier need the same treatment.)Claw and Dagger Mastery's crit chance was only counted when the right skill's item type is hand-to-hand (
h2h), i.e. Dragon Claw and Weapon Block. Attack isweapand PD2's claw skills areasm, so it was missing almost always.Poison length. The game adds the difficulty penalty to "Poison Length Reduced by", clamps the result to -100..75 and scales the length by (100 - that)%. The panel printed
100 - penalty - reductionwithout the clamp.Changes
BH/D2Helpers.cppGetMasteryStat: when the weapon doesn't match the mastery's item type, subtract crushing blow, crushing blow efficiency, crit multiplier and pierce (all four are in the client's stats). Count Claw and Dagger Mastery crit for melee weapon skills (same test as One Hand Mastery) and forasmskillsBH/Constants.hITEM_TYPE_ASSASSIN_MASTERY(91,asm)BH/Drawing/Stats/StatsDisplay.cpp/in the curse rowOne Hand Mastery and Throwing Mastery crit chance were already correct, and stay as they are.
Testing
In game (PD2 Season 13 client, single player): an Assassin with Two Hand, Throwing, Javelin and Spear, and Claw and Dagger Mastery at level 20. I checked 6 weapon/skill cases × 3 rows, plus the resist and leech rows. Expected values come from PD2's Skills.txt (level 20: 2HM crushing blow 29, efficiency +25; Throwing Mastery pierce 41; JSM crit multiplier +29; Claw and Dagger Mastery crit 25).
main; the shipped PD2 BH.dll draws the same lines)29 / 125%0 / 100%0 / 75 / 229%0 / 75 / 200%41029 / 125%29 / 125%0 / 75 / 229%/410 / 75 / 229%/4129 / 125%0 / 100%0 / 75 / 229%25 / 75 / 200%Length: 0%Length: 25%Screenshots
Hand axe
Katar, Attack
Resist rows: 100% poison length reduction, 90% curse resistance, 80% reduced curse duration
Unit tests for the poison length (13 cases, Normal/Nightmare/Hell) and the resist-row colors run
StatsDisplay.cppagainst a fake engine. They fail onmainand pass here. A clang-cl build of this branch launched cleanly 10/10 times in the PD2 client and 10/10 in vanilla 1.13c.Full evidence (all cases, derivations, full-frame screenshots, and the reported issues that turned out not to be bugs): PR-EVIDENCE.md