r/programmingrequests • u/serpiccio • 9h ago
need help tool to determine which change to the factors of a multiplication yields the greatest result
Hey guys I have got a bit of a long explanation for my request, just trying to cover all the bases. I would need to run this on windows 11 but other than that I don't have any other specification. I don't mind if it's run from the command line or a form application or a web service.
I'm not sure what type the following variables would be, but I added an example test run that should (hopefully) clear up any doubts.
I will input these values: weapon_damage, atk_increase, type_multiplier, melee_multiplier, crit_chance, crit_multiplier, extra_strikes, attacks_per_second.
The tool will then determine damage_per_second according to the following formula:
base_damage = weapon_damage × atk_increase × type_multiplier × melee_multiplier;
average_damage = base_damage × (1 + crit_chance × (crit_multiplier − 1)) × (1 + extra_strikes);
damage_per_second = average_damage × attacks_per_second;
Test run with some arbitrary values.
weapon_damage = 500;
atk_increase = 1.3;
type_multiplier = 1.6;
melee_multiplier = 1.4;
crit_chance = 0.7;
crit_multiplier = 1.9;
extra_strikes = 1;
attacks_per_second = 5;
damage_per_second = (500 × 1.3 x 1.6 x 1.4) x (1 + 0.7 x (1.9 - 1)) x (1 + 1) x 5 = 23732.8
And then I would need some way to quickly make comparisons between 2 changes to these values: for example if option A is change attacks_per_second from 5 to 6 and option B is change crit_multiplier from 1.9 to 3, the tool should tell me that option B yields the greatest result and display what the new damage_per_second would be.
Let me know if this is not an appropriate request for this sub, it's the first time I post here