MSUTeam / MSU

Modding Standards and Utilities for Battle Brothers
21 stars 4 forks source link

feat: auto calculate DamageType ratio in skills #383

Closed LordMidas closed 1 month ago

LordMidas commented 2 months ago

Originally we calculated approximate ratios for these "mixed" damage type skills based on the number of injuries there are in vanilla and hard-coded them as weights in the containers so that the injury inflicting behavior with MSU damage type system corresponds to the probability of injuries in vanilla. However, mods may change the number of different types of injuries, causing this ratio to no longer represent the new ratio of injuries. This PR ensures that the ratio is calculated dynamically.

I have used the MSU.Math.roundToMult function #358 to round it to the nearest multiple of 5. For the case of vanilla this only affects BluntAndPiercing which in vanilla was giving a ratio of 58/42 but we had it set at 45/55. The others were already exact at multiples of 5. I believe rounded to the nearest multiple of 5 is still good as it keeps the damage type ratios more "clean" for the players in tooltips.

LordMidas commented 2 months ago

What about all the other combinations of damage types? Are other mods supposed to add to this then?

This is meant to convert vanilla skills (or modded skills which use vanilla injuries but don't use the MSU damage type system) to the MSU damage type system. So we cover all the vanilla injury combinations.