Widget talk:PriceCalculator

From bg3.wiki
Revision as of 22:27, 22 November 2023 by 81.82.46.46 (talk)
Jump to navigation Jump to search

this calculator's math is wrong.

both the effect of persuasion and attitude is half of what it should be.

the correct math is: persuasion *0.1, attitude * 0.005

just did a test to be sure. potion of flying: value 30, tactician difficulty, persuasion modifier 7, 100 attitude. according to "my math" the total modifier is 2.5+0.5-0.7-0.5=1.8. predicted sell price: 30/1.8=17, predicted buy price. 30*1.8=54. matches with in-game numbers.

unsigned comment by 81.82.46.46 (talk) 21:26, 22 November 2023

Thanks for pointing that out. Will fix. - Sky (talk) 22:02, 22 November 2023 (CET)Reply[reply]

The formula is correct now, but there's a rounding error. Using the numbers from the test case above, the widget gives 53 and 16 instead of 54 and 17. The in-game sell price of 17 is a rounding of 16.666... but the widget uses a "floor" command. The buy price discrepancy puzzles me. 54 is the exact value (30*1.8). You'd think the calculations must have some intermediary steps where rounding takes place, but I don't see it in the code. A similar error happens with persuasion 12, where it gives a buy price of 38 instead of 39. Even more weirdly, using a persuasion value of 11.99999 gives 39, as one would expect, but entering 12 makes it drop to 38.